Image decoding method and apparatus for deriving weight index information for weighted average when bi-prediction is applied

ABSTRACT

According to a disclosure of the present document, when the type of inter-prediction of a current block is indicated as biprediction, weight index information for a candidate within a merge candidate list or a sub-block merge candidate list may be derived, and coding efficiency may be increased.

CROSS-REFERENCE TO RELATED APPLICATIONS

Pursuant to 35 U.S.C. § 119(e), this application is a continuation ofInternational Application PCT/KR2020/007522, with an internationalfiling date of Jun. 10, 2020, which claims the benefit of U.S.Provisional Patent Application No. 62/861,988, filed on Jun. 14, 2019,the contents of which are hereby incorporated by reference herein intheir entirety.

BACKGROUND OF THE DISCLOSURE Field of the Disclosure

The present disclosure relates to an image decoding method and apparatusfor deriving weight index information on a weighted average whenbi-prediction is applied.

Related Art

Recently, the demand for high resolution, high quality image/video suchas 4K, 8K or more Ultra High Definition (UHD) image/video is increasingin various fields. As the image/video resolution or quality becomeshigher, relatively more amount of information or bits are transmittedthan for conventional image/video data. Therefore, if image/video dataare transmitted via a medium such as an existing wired/wirelessbroadband line or stored in a legacy storage medium, costs fortransmission and storage are readily increased.

Moreover, interests and demand are growing for virtual reality (VR) andartificial reality (AR) contents, and immersive media such as hologram;and broadcasting of images/videos exhibiting image/video characteristicsdifferent from those of an actual image/video, such as gameimages/videos, are also growing.

Therefore, a highly efficient image/video compression technique isrequired to effectively compress and transmit, store, or play highresolution, high quality images/videos showing various characteristicsas described above.

SUMMARY

The present disclosure provides a method and an apparatus for increasingimage coding efficiency.

The present disclosure also provides a method and apparatus for derivingweight index information on bi-prediction in inter-prediction.

The present disclosure also provides a method and apparatus for derivingweight index information on a weighted average when bi-prediction isapplied.

In an aspect, an image decoding method performed by a decoding apparatusis provided. The method performed includes: obtaining image informationincluding inter-prediction mode information and residual informationthrough a bitstream; generating residual samples based on the residualinformation; generating a merge candidate list of a current block basedon the inter-prediction mode information; deriving motion information onthe current block based on a candidate selected from the merge candidatelist; generating L0 prediction samples and L1 prediction samples of thecurrent block based on the motion information; generating predictionsamples of the current block based on the L0 prediction samples, the L1prediction samples, and weight information, wherein the weightinformation is derived based on weight index information on the selectedcandidate; and generating reconstructed samples based on the predictionsamples and the residual sample, in which the candidates include anaffine merge candidate, and the affine merge candidate includes at leastone of motion vectors for control point 0 (CP0) positioned at a top ofthe current block, control point 1 (CP1) positioned at a top-right ofthe current block, control point 2 (CP2) positioned at a bottom-left ofthe current block, and control point 3 (CP3) positioned at a lower rightof the current block, when the affine merge candidate is generated basedon any one of {CP0, CP1, CP2}, {CP0, CP1, CP3}, {CP0, CP2, CP3}, {CP0,CP1}, and {CP0, CP2}, weight index information on the affine mergecandidate is derived based on weight index information on a specificblock among neighboring blocks of the CP0, and when the affine mergecandidate is generated based on {CP1, CP2, CP3}, the weight indexinformation on the affine merge candidate is derived based on weightindex information on a specific block among neighboring blocks of theCP1.

In another aspect, an image encoding method performed by an encodingapparatus is provided. The method includes: determining aninter-prediction mode of the current block and generatinginter-prediction mode information indicating the inter-prediction mode;generating a merge candidate list of the current block based on theinter-prediction mode; generating selection information indicating oneof candidates included in the merge candidate list; generating residualinformation based on residual samples of the current block; and encodingimage information including the inter-prediction mode information, theselection information, and the residual information, in which thecandidates include an affine merge candidate, and the affine mergecandidate includes at least one of motion vectors for control point 0(CP0) positioned at a top of the current block, control point 1 (CP1)positioned at a top-right of the current block, control point 2 (CP2)positioned at a bottom-left of the current block, and control point 3(CP3) positioned at a lower right of the current block, when the affinemerge candidate is generated based on any one of {CP0, CP1, CP2}, {CP0,CP1, CP3}, {CP0, CP2, CP3}, {CP0, CP1}, and {CP0, CP2}, weight indexinformation on the affine merge candidate is indicated based on weightindex information on a specific block among neighboring blocks of theCP0, and when the affine merge candidate is generated based on {CP1,CP2, CP3}, the weight index information on the affine merge candidate isindicated based on weight index information on a specific block amongneighboring blocks of the CP1.

In still another aspect, a computer-readable storage medium storingencoded information causing an image decoding apparatus to perform animage decoding method is provided. The image decoding method includes:obtaining image information including inter-prediction mode informationand residual information through a bitstream; generating residualsamples based on the residual information; generating a merge candidatelist of a current block based on the inter-prediction mode information;deriving motion information on the current block based on a candidateselected from the merge candidate list; generating L0 prediction samplesand L1 prediction samples of the current block based on the motioninformation; generating prediction samples of the current block based onthe L0 prediction samples, the L1 prediction samples, and weightinformation, wherein the weight information is derived based on weightindex information on the selected candidate; and generatingreconstructed samples based on the prediction samples and the residualsample, in which the candidates include an affine merge candidate, andthe affine merge candidate includes at least one of motion vectors forcontrol point 0 (CP0) positioned at a top of the current block, controlpoint 1 (CP1) positioned at a top-right of the current block, controlpoint 2 (CP2) positioned at a bottom-left of the current block, andcontrol point 3 (CP3) positioned at a lower right of the current block,when the affine merge candidate is generated based on any one of {CP0,CP1, CP2}, {CP0, CP1, CP3}, {CP0, CP2, CP3}, {CP0, CP1}, and {CP0, CP2},weight index information on the affine merge candidate is derived basedon weight index information on a specific block among neighboring blocksof the CP0, and when the affine merge candidate is generated based on{CP1, CP2, CP3}, the weight index information on the affine mergecandidate is derived based on weight index information on a specificblock among neighboring blocks of the CP1.

According to the present disclosure, it is possible to increase theoverall image/video compression efficiency.

According to the present, it is possible to efficiently construct motionvector candidates during inter-prediction.

According to the present disclosure, it is possible to efficientlyperform weight-based bi-prediction.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a diagram schematically illustrating an example of avideo/image coding system to which embodiments of the present disclosuremay be applied.

FIG. 2 is a diagram schematically illustrating a configuration of avideo/image encoding apparatus to which embodiments of the presentdisclosure may be applied.

FIG. 3 is a diagram schematically illustrating a configuration of avideo/image decoding apparatus to which embodiments of the presentdisclosure may be applied.

FIG. 4 is a diagram illustrating an example of a video/image encodingmethod based on inter-prediction.

FIG. 5 is a diagram schematically illustrating an inter-prediction unitin an encoding apparatus.

FIG. 6 is a diagram illustrating an example of a video/image encodingmethod based on inter-prediction.

FIG. 7 is a diagram schematically illustrating an inter-prediction unitin a decoding apparatus.

FIG. 8 is a diagram for describing a merge mode in inter-prediction.

FIGS. 9A and 9B are diagram exemplarily illustrating CPMV for affinemotion prediction.

FIG. 10 is a diagram exemplarily illustrating a case in which an affineMVF is determined in units of subblocks.

FIG. 11 is a diagram for describing an affine merge mode ininter-prediction.

FIG. 12 is a diagram for describing positions of candidates in an affinemerge mode.

FIG. 13 is a diagram for describing SbTMVP in inter-prediction.

FIGS. 14 and 15 are diagrams schematically illustrating an example of avideo/image encoding method and related components according toembodiment(s) of the present disclosure.

FIGS. 16 and 17 are diagrams schematically illustrating an example of animage/video decoding method and related components according toembodiment(s) of the present disclosure.

FIG. 18 is a diagram illustrating an example of a content streamingsystem to which embodiments disclosed in the present disclosure may beapplied.

DESCRIPTION OF EXEMPLARY EMBODIMENTS

The present disclosure may be variously modified and have severalexemplary embodiments. Therefore, specific exemplary embodiments of thepresent disclosure will be illustrated in the accompanying drawings andbe described in detail. However, this is not intended to limit thepresent disclosure to specific embodiments. The terms used in thepresent disclosure are only used to describe specific embodiments, andare not intended to limit the technical idea of the embodiments of thepresent disclosure. Singular forms are intended to include plural formsunless the context clearly indicates otherwise. It will be furtherunderstood that the terms “comprises” or “have” used in thisspecification, specify the presence of stated features, steps,operations, components, parts mentioned in this specification, or acombination thereof, but do not preclude the presence or addition of oneor more other features, numerals, steps, operations, components, parts,or a combination thereof.

Meanwhile, each component in the drawings described in the presentdisclosure is illustrated independently for convenience of descriptionregarding different characteristic functions, and does not mean thateach component is implemented as separate hardware or separate software.For example, two or more components among each component may be combinedto form one component, or one component may be divided into a pluralityof components. Embodiments in which each component is integrated and/orseparated are also included in the scope of the present disclosure.

The present disclosure relates to video/image coding. For example, themethod/embodiment disclosed in the present disclosure may be applied toa method disclosed in versatile video coding (VVC) standard. Inaddition, the method/embodiment disclosed in the present disclosure maybe applied to the methods disclosed in an essential video coding (EVC)standard, an AOMedia Video 1 (AV1) standard, 2nd generation of audiovideo coding standard (AVS2), or a next-generation video/image codingstandard (ex. H.267 or H.268, etc).

The present disclosure presents various embodiments related tovideo/image coding, and unless otherwise stated, the embodiments may beperformed by being combined with each other.

Hereinafter, embodiments of the present disclosure will be describedwith reference to the accompanying drawings. Hereinafter, the samereference numerals may be used for the same components in the drawings,and duplicate descriptions of the same components may be omitted.

FIG. 1 illustrates an example of a video/image coding system to whichthe embodiments of the present disclosure may be applied.

Referring to FIG. 1, a video/image coding system may include a firstdevice (a source device) and a second device (a reception device). Thesource device may transmit encoded video/image information or data tothe reception device through a digital storage medium or network in theform of a file or streaming.

The source device may include a video source, an encoding apparatus, anda transmitter. The receiving device may include a receiver, a decodingapparatus, and a renderer. The encoding apparatus may be called avideo/image encoding apparatus, and the decoding apparatus may be calleda video/image decoding apparatus. The transmitter may be included in theencoding apparatus. The receiver may be included in the decodingapparatus. The renderer may include a display, and the display may beconfigured as a separate device or an external component.

The video source may acquire video/image through a process of capturing,synthesizing, or generating the video/image. The video source mayinclude a video/image capture device and/or a video/image generatingdevice. The video/image capture device may include, for example, one ormore cameras, video/image archives including previously capturedvideo/images, and the like. The video/image generating device mayinclude, for example, computers, tablets and smartphones, and may(electronically) generate video/images. For example, a virtualvideo/image may be generated through a computer or the like. In thiscase, the video/image capturing process may be replaced by a process ofgenerating related data.

The encoding apparatus may encode input video/image. The encodingapparatus may perform a series of procedures such as prediction,transform, and quantization for compaction and coding efficiency. Theencoded data (encoded video/image information) may be output in the formof a bitstream.

The transmitter may transmit the encoded image/image information or dataoutput in the form of a bitstream to the receiver of the receivingdevice through a digital storage medium or a network in the form of afile or streaming. The digital storage medium may include variousstorage mediums such as USB, SD, CD, DVD, Blu-ray, HDD, SSD, and thelike. The transmitter may include an element for generating a media filethrough a predetermined file format and may include an element fortransmission through a broadcast/communication network. The receiver mayreceive/extract the bitstream and transmit the received bitstream to thedecoding apparatus.

The decoding apparatus may decode the video/image by performing a seriesof procedures such as dequantization, inverse transform, and predictioncorresponding to the operation of the encoding apparatus.

The renderer may render the decoded video/image. The renderedvideo/image may be displayed through the display.

The present disclosure relates to video/image coding. For example, themethod/embodiment disclosed in the present disclosure may be applied tothe methods disclosed in a verstatile video coding (VVC) standard, anessential video coding (EVC) standard, an AOMedia Video 1 (AV1)standard, 2nd generation of audio video coding standard (AVS2), or anext-generation video/image coding standard (ex. H.267 or H.268, etc).

This document suggests various embodiments of video/image coding, andthe above embodiments may also be performed in combination with eachother unless otherwise specified.

In this document, a video may refer to a series of images over time. Apicture generally refers to the unit representing one image at aparticular time frame, and a slice/tile refers to the unit constitutinga part of the picture in terms of coding. A slice/tile may include oneor more coding tree units (CTUs). One picture may consist of one or moreslices/tiles.

A tile is a rectangular region of CTUs within a particular tile columnand a particular tile row in a picture. The tile column is a rectangularregion of CTUs having a height equal to the height of the picture and awidth specified by syntax elements in the picture parameter set. Thetile row is a rectangular region of CTUs having a height specified bysyntax elements in the picture parameter set and a width equal to thewidth of the picture. A tile scan is a specific sequential ordering ofCTUs partitioning a picture in which the CTUs are ordered consecutivelyin CTU raster scan in a tile whereas tiles in a picture are orderedconsecutively in a raster scan of the tiles of the picture. A slice maycomprise a number of complete tiles or a number of consecutive CTU rowsin one tile of a picture that may be contained in one NAL unit. In thisdocument, tile group and slice can be used interchangeably. For example,in this document, a tile group/tile group header may be referred to as aslice/slice header.

Meanwhile, one picture may be divided into two or more subpictures. Thesubpicture may be a rectangular region of one or more slices within apicture.

A pixel or a pel may mean a smallest unit constituting one picture (orimage). Also, ‘sample’ may be used as a term corresponding to a pixel. Asample may generally represent a pixel or a value of a pixel, and mayrepresent only a pixel/pixel value of a luma component or only apixel/pixel value of a chroma component.

A unit may represent a basic unit of image processing. The unit mayinclude at least one of a specific region of the picture and informationrelated to the region. One unit may include one luma block and twochroma (ex. cb, cr) blocks. The unit may be used interchangeably withterms such as block or area in some cases. In a general case, an M×Nblock may include samples (or sample arrays) or a set (or array) oftransform coefficients of M columns and N rows. Alternatively, thesample may mean a pixel value in the spatial domain, and when such apixel value is transformed to the frequency domain, it may mean atransform coefficient in the frequency domain.

In the present disclosure, “A or B” may mean “only A”, “only B” or “bothA and B”. In other words, “A or B” in the present disclosure may beinterpreted as “A and/or B”. For example, in the present disclosure, “A,B, or C” means “only A”, “only B”, “only C”, or “any and any combinationof A, B, and C”.

A slash (/) or comma (comma) used in the present disclosure may mean“and/or”. For example, “A/B” may mean “and/or B”. Accordingly, “A/B” maymean “only A”, “only B”, or “both A and B”. For example, “A, B, C” maymean “A, B, or C”.

In the present disclosure, “at least one of A and B” may mean “only A”“only B” or “both A and B”. Also, in the present disclosure, theexpression “at least one of A or B” or “at least one of A and/or B”means may be interpreted equivalently to the expression “at least one ofA and B”.

Also, in the present disclosure, “at least one of A, B, and C” means“only A”, “only B”, “only C”, or “any combination of A, B and C”. Also,“at least one of A, B, or C” or “at least one of A, B and/or C” meansmay mean “at least one of A, B, and C.”

Also, parentheses used in the present disclosure may mean “for example.”Specifically, when “prediction (intra-prediction)” is indicated,“intra-prediction” may be proposed as an example of “prediction.” Inother words, “prediction” in the present disclosure is not limited to“intra-prediction,” and “intra-prediction” may be proposed as an exampleof “prediction.” In addition, when “prediction (intra-prediction)” isindicated, “intra-prediction” may be proposed as an example of“prediction.”

Technical features that are individually described within one drawing inthe present disclosure may be implemented individually or may beimplemented at the same time.

FIG. 2 is a diagram schematically illustrating the configuration of avideo/image encoding apparatus to which the disclosure of the presentdocument may be applied. Hereinafter, what is referred to as the videoencoding apparatus may include an image encoding apparatus.

Referring to FIG. 2, the encoding apparatus 200 may include and beconfigured with an image partitioner 210, a predictor 220, a residualprocessor 230, an entropy encoder 240, an adder 250, a filter 260, and amemory 270. The predictor 220 may include an inter predictor 221 and anintra predictor 222. The residual processor 230 may include atransformer 232, a quantizer 233, a dequantizer 234, and an inversetransformer 235. The residual processor 230 may further include asubtractor 231. The adder 250 may be called a reconstructor orreconstructed block generator. The image partitioner 210, the predictor220, the residual processor 230, the entropy encoder 240, the adder 250,and the filter 260, which have been described above, may be configuredby one or more hardware components (e.g., encoder chipsets orprocessors) according to an embodiment. In addition, the memory 270 mayinclude a decoded picture buffer (DPB), and may also be configured by adigital storage medium. The hardware component may further include thememory 270 as an internal/external component.

The image partitioner 210 may split an input image (or, picture, frame)input to the encoding apparatus 200 into one or more processing units.As an example, the processing unit may be called a coding unit (CU). Inthis case, the coding unit may be recursively split according to aQuad-tree binary-tree ternary-tree (QTBTTT) structure from a coding treeunit (CTU) or the largest coding unit (LCU). For example, one codingunit may be split into a plurality of coding units of a deeper depthbased on a quad-tree structure, a binary-tree structure, and/or aternary-tree structure. In this case, for example, the quad-treestructure is first applied and the binary-tree structure and/or theternary-tree structure may be later applied. Alternatively, thebinary-tree structure may also be first applied. A coding procedureaccording to the present disclosure may be performed based on a finalcoding unit which is not split any more. In this case, based on codingefficiency according to image characteristics or the like, the maximumcoding unit may be directly used as the final coding unit, or asnecessary, the coding unit may be recursively split into coding units ofa deeper depth, such that a coding unit having an optimal size may beused as the final coding unit. Here, the coding procedure may include aprocedure such as prediction, transform, and reconstruction to bedescribed later. As another example, the processing unit may furtherinclude a predictor (PU) or a transform unit (TU). In this case, each ofthe predictor and the transform unit may be split or partitioned fromthe aforementioned final coding unit. The predictor may be a unit ofsample prediction, and the transform unit may be a unit for inducing atransform coefficient and/or a unit for inducing a residual signal fromthe transform coefficient.

The unit may be interchangeably used with the term such as a block or anarea in some cases. Generally, an M×N block may represent samplescomposed of M columns and N rows or a group of transform coefficients.The sample may generally represent a pixel or a value of the pixel, andmay also represent only the pixel/pixel value of a luma component, andalso represent only the pixel/pixel value of a chroma component. Thesample may be used as the term corresponding to a pixel or a pelconfiguring one picture (or image).

The encoding apparatus 200 may subtract the prediction signal (predictedblock, prediction sample array) output from the inter predictor 221 orthe intra predictor 222 from the input image signal (original block,original sample array) to generate a residual signal (residual block,residual sample array), and the generated residual signal is transmittedto the transformer 232. In this case, as illustrated, a unit forsubtracting the prediction signal (prediction block, prediction samplearray) from an input image signal (original block, original samplearray) in the encoder 200 may be referred to as a subtractor 231. Thepredictor may perform prediction on a processing target block(hereinafter, referred to as a current block) and generate a predictedblock including prediction samples for the current block. The predictormay determine whether intra prediction or inter prediction is applied inunits of a current block or CU. The predictor may generate variousinformation on prediction, such as prediction mode information, andtransmit the generated information to the entropy encoder 240, as isdescribed below in the description of each prediction mode. Theinformation on prediction may be encoded by the entropy encoder 240 andoutput in the form of a bitstream.

The intra predictor 222 may predict a current block with reference tosamples within a current picture. The referenced samples may be locatedneighboring to the current block, or may also be located away from thecurrent block according to the prediction mode. The prediction modes inthe intra prediction may include a plurality of non-directional modesand a plurality of directional modes. The non-directional mode mayinclude, for example, a DC mode or a planar mode. The directional modemay include, for example, 33 directional prediction modes or 65directional prediction modes according to the fine degree of theprediction direction. However, this is illustrative and the directionalprediction modes which are more or less than the above number may beused according to the setting. The intra predictor 222 may alsodetermine the prediction mode applied to the current block using theprediction mode applied to the neighboring block.

The inter predictor 221 may induce a predicted block of the currentblock based on a reference block (reference sample array) specified by amotion vector on a reference picture. At this time, in order to decreasethe amount of motion information transmitted in the inter predictionmode, the motion information may be predicted in units of a block, asub-block, or a sample based on the correlation of the motioninformation between the neighboring block and the current block. Themotion information may include a motion vector and a reference pictureindex. The motion information may further include inter predictiondirection (L0 prediction, L1 prediction, Bi prediction, or the like)information. In the case of the inter prediction, the neighboring blockmay include a spatial neighboring block existing within the currentpicture and a temporal neighboring block existing in the referencepicture. The reference picture including the reference block and thereference picture including the temporal neighboring block may also bethe same as each other, and may also be different from each other. Thetemporal neighboring block may be called the name such as a collocatedreference block, a collocated CU (colCU), or the like, and the referencepicture including the temporal neighboring block may also be called acollocated picture (colPic). For example, the inter predictor 221 mayconfigure a motion information candidate list based on the neighboringblocks, and generate information indicating what candidate is used toderive the motion vector and/or the reference picture index of thecurrent block. The inter prediction may be performed based on variousprediction modes, and for example, in the case of a skip mode and amerge mode, the inter predictor 221 may use the motion information ofthe neighboring block as the motion information of the current block. Inthe case of the skip mode, the residual signal may not be transmittedunlike the merge mode. A motion vector prediction (MVP) mode mayindicate the motion vector of the current block by using the motionvector of the neighboring block as a motion vector predictor, andsignaling a motion vector difference.

The predictor 220 may generate a prediction signal based on variousprediction methods to be described below. For example, the predictor mayapply intra prediction or inter prediction for prediction of one blockand may simultaneously apply intra prediction and inter prediction. Thismay be called combined inter and intra prediction (CIIP). In addition,the predictor may be based on an intra block copy (IBC) prediction modeor based on a palette mode for prediction of a block. The IBC predictionmode or the palette mode may be used for image/video coding of contentsuch as games, for example, screen content coding (SCC). IBC basicallyperforms prediction within the current picture, but may be performedsimilarly to inter prediction in that a reference block is derivedwithin the current picture. That is, IBC may use at least one of theinter prediction techniques described in this document. The palette modemay be viewed as an example of intra coding or intra prediction. Whenthe palette mode is applied, a sample value in the picture may besignaled based on information on the palette table and the paletteindex.

The prediction signal generated by the predictor (including the interpredictor 221 and/or the intra predictor 222) may be used to generate areconstructed signal or may be used to generate a residual signal. Thetransformer 232 may generate transform coefficients by applying atransform technique to the residual signal. For example, the transformtechnique may include at least one of a discrete cosine transform (DCT),a discrete sine transform (DST), a Karhunen-Loeve Transform (KLT), agraph-based transform (GBT), or a conditionally non-linear transform(CNT). Here, GBT refers to transformation obtained from a graph whenexpressing relationship information between pixels in the graph. CNTrefers to transformation obtained based on a prediction signal generatedusing all previously reconstructed pixels. Also, the transformationprocess may be applied to a block of pixels having the same size as asquare or may be applied to a block of a variable size that is not asquare.

The quantizer 233 quantizes the transform coefficients and transmits thesame to the entropy encoder 240, and the entropy encoder 240 encodes thequantized signal (information on the quantized transform coefficients)and outputs the encoded signal as a bitstream. Information on thequantized transform coefficients may be referred to as residualinformation. The quantizer 233 may rearrange the quantized transformcoefficients in the block form into a one-dimensional vector form basedon a coefficient scan order and may generate information on thetransform coefficients based on the quantized transform coefficients inthe one-dimensional vector form. The entropy encoder 240 may performvarious encoding methods such as, for example, exponential Golomb,context-adaptive rvaiable length coding (CAVLC), and context-adaptivebinary arithmetic coding (CABAC). The entropy encoder 240 may encodeinformation necessary for video/image reconstruction (e.g., values ofsyntax elements, etc.) other than the quantized transform coefficientstogether or separately. Encoded information (e.g., encoded video/imageinformation) may be transmitted or stored in units of a networkabstraction layer (NAL) unit in the form of a bitstream. The video/imageinformation may further include information on various parameter sets,such as an adaptation parameter set (APS), a picture parameter set(PPS), a sequence parameter set (SPS), or a video parameter set (VPS).Also, the video/image information may further include general constraintinformation. In this document, information and/or syntax elementstransmitted/signaled from the encoding apparatus to the decodingapparatus may be included in video/image information. The video/imageinformation may be encoded through the encoding procedure describedabove and included in the bitstream. The bitstream may be transmittedthrough a network or may be stored in a digital storage medium. Here,the network may include a broadcasting network and/or a communicationnetwork, and the digital storage medium may include various storagemedia such as USB, SD, CD, DVD, Blu-ray, HDD, and SSD. A transmittingunit (not shown) and/or a storing unit (not shown) for transmitting orstoring a signal output from the entropy encoder 240 may be configuredas internal/external elements of the encoding apparatus 200, or thetransmitting unit may be included in the entropy encoder 240.

The quantized transform coefficients output from the quantizer 233 maybe used to generate a prediction signal. For example, the residualsignal (residual block or residual samples) may be reconstructed byapplying dequantization and inverse transform to the quantized transformcoefficients through the dequantizer 234 and the inverse transform unit235. The adder 250 may add the reconstructed residual signal to theprediction signal output from the inter predictor 221 or the intrapredictor 222 to generate a reconstructed signal (reconstructed picture,reconstructed block, reconstructed sample array). When there is noresidual for the processing target block, such as when the skip mode isapplied, the predicted block may be used as a reconstructed block. Theadder 250 may be referred to as a restoration unit or a restorationblock generator. The generated reconstructed signal may be used forintra prediction of a next processing target block in the currentpicture, or may be used for inter prediction of the next picture afterbeing filtered as described below.

Meanwhile, luma mapping with chroma scaling (LMCS) may be applied duringa picture encoding and/or reconstruction process.

The filter 260 may improve subjective/objective image quality byapplying filtering to the reconstructed signal. For example, the filter260 may generate a modified reconstructed picture by applying variousfiltering methods to the reconstructed picture, and store the modifiedreconstructed picture in the memory 270, specifically, in a DPB of thememory 270. The various filtering methods may include, for example,deblocking filtering, a sample adaptive offset, an adaptive loop filter,a bilateral filter, and the like. The filter 260 may generate variouskinds of information related to the filtering, and transfer thegenerated information to the entropy encoder 240 as described later inthe description of each filtering method. The information related to thefiltering may be encoded by the entropy encoder 240 and output in theform of a bitstream.

The modified reconstructed picture transmitted to the memory 270 may beused as a reference picture in the inter predictor 221. When the interprediction is applied through the encoding apparatus, predictionmismatch between the encoding apparatus 200 and the decoding apparatuscan be avoided and encoding efficiency can be improved.

The DPB of the memory 270 may store the modified reconstructed picturefor use as the reference picture in the inter predictor 221. The memory270 may store motion information of a block from which the motioninformation in the current picture is derived (or encoded) and/or motioninformation of blocks in the picture, having already been reconstructed.The stored motion information may be transferred to the inter predictor221 to be utilized as motion information of the spatial neighboringblock or motion information of the temporal neighboring block. Thememory 270 may store reconstructed samples of reconstructed blocks inthe current picture, and may transfer the reconstructed samples to theintra predictor 222.

Meanwhile, in this document, at least one of quantization/dequantizationand/or transform/inverse transform may be omitted. When thequantization/dequantization is omitted, the quantized transformcoefficient may be referred to as a transform coefficient. When thetransform/inverse transform is omitted, the transform coefficient may becalled a coefficient or a residual coefficient or may still be calledthe transform coefficient for uniformity of expression.

Further, in this document, the quantized transform coefficient and thetransform coefficient may be referred to as a transform coefficient anda scaled transform coefficient, respectively. In this case, the residualinformation may include information on transform coefficient(s), and theinformation on the transform coefficient(s) may be signaled throughresidual coding syntax. Transform coefficients may be derived based onthe residual information (or information on the transformcoefficient(s)), and scaled transform coefficients may be derivedthrough inverse transform (scaling) on the transform coefficients.Residual samples may be derived based on inverse transform (transform)of the scaled transform coefficients. This may be applied/expressed inother parts of this document as well.

FIG. 3 is a diagram for schematically explaining the configuration of avideo/image decoding apparatus to which the disclosure of the presentdocument may be applied.

Referring to FIG. 3, the decoding apparatus 300 may include andconfigured with an entropy decoder 310, a residual processor 320, apredictor 330, an adder 340, a filter 350, and a memory 360. Thepredictor 330 may include an intra predictor 331 and an inter predictor332. The residual processor 320 may include a dequantizer 321 and aninverse transformer 322. The entropy decoder 310, the residual processor320, the predictor 330, the adder 340, and the filter 350, which havebeen described above, may be configured by one or more hardwarecomponents (e.g., decoder chipsets or processors) according to anembodiment. Further, the memory 360 may include a decoded picture buffer(DPB), and may be configured by a digital storage medium. The hardwarecomponent may further include the memory 360 as an internal/externalcomponent.

When the bitstream including the video/image information is input, thedecoding apparatus 300 may reconstruct the image in response to aprocess in which the video/image information is processed in theencoding apparatus illustrated in FIG. 2. For example, the decodingapparatus 300 may derive the units/blocks based on block split-relatedinformation acquired from the bitstream. The decoding apparatus 300 mayperform decoding using the processing unit applied to the encodingapparatus. Therefore, the processing unit for the decoding may be, forexample, a coding unit, and the coding unit may be split according tothe quad-tree structure, the binary-tree structure, and/or theternary-tree structure from the coding tree unit or the maximum codingunit. One or more transform units may be derived from the coding unit.In addition, the reconstructed image signal decoded and output throughthe decoding apparatus 300 may be reproduced through a reproducingapparatus.

The decoding apparatus 300 may receive a signal output from the encodingapparatus of FIG. 2 in the form of a bitstream, and the received signalmay be decoded through the entropy decoder 310. For example, the entropydecoder 310 may parse the bitstream to derive information (e.g.,video/image information) necessary for image reconstruction (or picturereconstruction). The video/image information may further includeinformation on various parameter sets such as an adaptation parameterset (APS), a picture parameter set (PPS), a sequence parameter set(SPS), or a video parameter set (VPS). In addition, the video/imageinformation may further include general constraint information. Thedecoding apparatus may further decode picture based on the informationon the parameter set and/or the general constraint information.Signaled/received information and/or syntax elements described later inthis document may be decoded may decode the decoding procedure andobtained from the bitstream. For example, the entropy decoder 310decodes the information in the bitstream based on a coding method suchas exponential Golomb coding, context-adaptive variable length coding(CAVLC), or context-adaptive arithmetic coding (CABAC), and outputsyntax elements required for image reconstruction and quantized valuesof transform coefficients for residual. More specifically, the CABACentropy decoding method may receive a bin corresponding to each syntaxelement in the bitstream, determine a context model by using a decodingtarget syntax element information, decoding information of a decodingtarget block or information of a symbol/bin decoded in a previous stage,and perform an arithmetic decoding on the bin by predicting aprobability of occurrence of a bin according to the determined contextmodel, and generate a symbol corresponding to the value of each syntaxelement. In this case, the CABAC entropy decoding method may update thecontext model by using the information of the decoded symbol/bin for acontext model of a next symbol/bin after determining the context model.The information related to the prediction among the information decodedby the entropy decoder 310 may be provided to the the predictor (interpredictor 332 and intra predictor 331), and residual values on which theentropy decoding has been performed in the entropy decoder 310, that is,the quantized transform coefficients and related parameter information,may be input to the residual processor 320.

The dequantizer 321 may dequantize the quantized transform coefficientsto output the transform coefficients. The dequantizer 321 may rearrangethe quantized transform coefficients in a two-dimensional block form. Inthis case, the rearrangement may be performed based on a coefficientscan order performed by the encoding apparatus. The dequantizer 321 mayperform dequantization for the quantized transform coefficients using aquantization parameter (e.g., quantization step size information), andacquire the transform coefficients.

The inverse transformer 322 inversely transforms the transformcoefficients to acquire the residual signal (residual block, residualsample array).

The predictor 330 may perform the prediction of the current block, andgenerate a predicted block including the prediction samples of thecurrent block. The predictor may determine whether the intra predictionis applied or the inter prediction is applied to the current block basedon the information about prediction output from the entropy decoder 310,and determine a specific intra/inter prediction mode.

The predictor 330 may generate a prediction signal based on variousprediction methods to be described later. For example, the predictor mayapply intra prediction or inter prediction for prediction of one block,and may simultaneously apply intra prediction and inter prediction. Thismay be called combined inter and intra prediction (CIIP). In addition,the predictor may be based on an intra block copy (IBC) prediction modeor based on a palette mode for prediction of a block. The IBC predictionmode or the palette mode may be used for image/video coding of contentsuch as games, for example, screen content coding (SCC). IBC maybasically perform prediction within the current picture, but may beperformed similarly to inter prediction in that a reference block isderived within the current picture. That is, IBC may use at least one ofthe inter prediction techniques described in this document. The palettemode may be considered as an example of intra coding or intraprediction. When the palette mode is applied, information on the palettetable and the palette index may be included in the video/imageinformation and signaled.

The intra predictor 3321 may predict the current block by referring tothe samples in the current picture. The referred samples may be locatedin the neighborhood of the current block, or may be located apart fromthe current block according to the prediction mode. In intra prediction,prediction modes may include a plurality of non-directional modes and aplurality of directional modes. The intra predictor 331 may determinethe prediction mode to be applied to the current block by using theprediction mode applied to the neighboring block.

The inter predictor 332 may derive a predicted block for the currentblock based on a reference block (reference sample array) specified by amotion vector on a reference picture. In this case, in order to reducethe amount of motion information being transmitted in the interprediction mode, motion information may be predicted in the unit ofblocks, subblocks, or samples based on correlation of motion informationbetween the neighboring block and the current block. The motioninformation may include a motion vector and a reference picture index.The motion information may further include information on interprediction direction (L0 prediction, L1 prediction, Bi prediction, andthe like). In case of inter prediction, the neighboring block mayinclude a spatial neighboring block existing in the current picture anda temporal neighboring block existing in the reference picture. Forexample, the inter predictor 332 may construct a motion informationcandidate list based on neighboring blocks, and derive a motion vectorof the current block and/or a reference picture index based on thereceived candidate selection information. Inter prediction may beperformed based on various prediction modes, and the information on theprediction may include information indicating a mode of inter predictionfor the current block.

The adder 340 may generate a reconstructed signal (reconstructedpicture, reconstructed block, or reconstructed sample array) by addingthe obtained residual signal to the prediction signal (predicted blockor predicted sample array) output from the predictor (including interpredictor 332 and/or intra predictor 331). If there is no residual forthe processing target block, such as a case that a skip mode is applied,the predicted block may be used as the reconstructed block.

The adder 340 may be called a reconstructor or a reconstructed blockgenerator. The generated reconstructed signal may be used for the intraprediction of a next block to be processed in the current picture, andas described later, may also be output through filtering or may also beused for the inter prediction of a next picture.

Meanwhile, a luma mapping with chroma scaling (LMCS) may also be appliedin the picture decoding process.

The filter 350 may improve subjective/objective image quality byapplying filtering to the reconstructed signal. For example, the filter350 may generate a modified reconstructed picture by applying variousfiltering methods to the reconstructed picture, and store the modifiedreconstructed picture in the memory 360, specifically, in a DPB of thememory 360. The various filtering methods may include, for example,deblocking filtering, a sample adaptive offset, an adaptive loop filter,a bilateral filter, and the like.

The (modified) reconstructed picture stored in the DPB of the memory 360may be used as a reference picture in the inter predictor 332. Thememory 360 may store the motion information of the block from which themotion information in the current picture is derived (or decoded) and/orthe motion information of the blocks in the picture having already beenreconstructed. The stored motion information may be transferred to theinter predictor 332 so as to be utilized as the motion information ofthe spatial neighboring block or the motion information of the temporalneighboring block. The memory 360 may store reconstructed samples ofreconstructed blocks in the current picture, and transfer thereconstructed samples to the intra predictor 331.

In this disclosure, the embodiments described in the filter 260, theinter predictor 221, and the intra predictor 222 of the encodingapparatus 200 may be applied equally or to correspond to the filter 350,the inter predictor 332, and the intra predictor 331.

As described above, in performing video coding, prediction is performedto improve compression efficiency. Through this, a predicted blockincluding prediction samples for a current block as a block to be coded(i.e., a coding target block) may be generated. Here, the predictedblock includes prediction samples in a spatial domain (or pixel domain).The predicted block is derived in the same manner in an encodingapparatus and a decoding apparatus, and the encoding apparatus maysignal information (residual information) on residual between theoriginal block and the predicted block, rather than an original samplevalue of an original block, to the decoding apparatus, therebyincreasing image coding efficiency. The decoding apparatus may derive aresidual block including residual samples based on the residualinformation, add the residual block and the predicted block to generatereconstructed blocks including reconstructed samples, and generate areconstructed picture including the reconstructed blocks.

The residual information may be generated through a transform andquantization procedure. For example, the encoding apparatus may derive aresidual block between the original block and the predicted block,perform a transform procedure on residual samples (residual samplearray) included in the residual block to derive transform coefficients,perform a quantization procedure on the transform coefficients to derivequantized transform coefficients, and signal related residualinformation to the decoding apparatus (through a bit stream). Here, theresidual information may include value information of the quantizedtransform coefficients, location information, a transform technique, atransform kernel, a quantization parameter, and the like. The decodingapparatus may perform dequantization/inverse transform procedure basedon the residual information and derive residual samples (or residualblocks). The decoding apparatus may generate a reconstructed picturebased on the predicted block and the residual block. Also, for referencefor inter prediction of a picture afterward, the encoding apparatus mayalso dequantize/inverse-transform the quantized transform coefficientsto derive a residual block and generate a reconstructed picture basedthereon.

FIG. 4 illustrates an example of a video/image encoding method based oninter-prediction, and FIG. 5 is an example schematically illustrating aninter-prediction unit in the encoding apparatus. The inter-predictionunit in the encoding apparatus of FIG. 5 may be applied to be identicalto or corresponding to an inter-prediction unit 221 of an encodingapparatus 200 of FIG. 2 described above.

Referring to FIGS. 4 and 5, the encoding apparatus performsinter-prediction on the current block (S400). The encoding apparatus mayderive inter-prediction mode and motion information of the currentblock, and generate prediction samples of the current block. Here,procedures of determining an inter-prediction mode, deriving motioninformation, and generating a prediction sample may be performedsimultaneously, or any one thereof may be performed before otherprocedures.

For example, an inter-prediction unit 221 of the encoding apparatus mayinclude a prediction mode determining unit 221_1, a motion informationderiving unit 221_2, and a prediction sample deriving unit 221_3, andthe prediction mode determining unit 221_1 may determine a predictionmode for the current block, the motion information derivation unit 221_2may derive the motion information of the current block, and theprediction sample derivation unit 221_3 may derive prediction samples ofthe current block. For example, the inter-prediction unit 221 of theencoding apparatus may search for a block similar to the current blockwithin a predetermined area (search area) of reference pictures throughmotion estimation, and derive a reference block having a difference fromthe current block equal to or less than a minimum or a certaincriterion. Based on this, a reference picture index indicating areference picture in which the reference block is positioned may bederived, and a motion vector may be derived based on a differencebetween the positions of the reference block and the current block. Theencoding apparatus may determine a mode applied to the current blockamong various prediction modes. The encoding apparatus may compare RDcosts for various prediction modes and determine an optimal predictionmode for the current block.

For example, when the skip mode or the merge mode is applied to thecurrent block, the encoding apparatus may construct a merge candidatelist, and derive a reference block having a difference of a minimum or apredetermined criterion or less from a current block among referenceblocks indicated by merge candidates included in the merge candidatelist. In this case, a merge candidate associated with the derivedreference block is selected, and merge index information indicating theselected merge candidate may be generated and signaled to the decodingapparatus. The motion information of the current block may be derivedusing motion information of the selected merge candidate.

As another example, when a (A)MVP mode is applied to the current block,the encoding apparatus may construct a (A)MVP candidate list, and mayuse a motion vector of an mvp candidate selected from among motionvector predictor (mvp) candidates included in the (A)MVP candidate listas the mvp of the current block. In this case, for example, the motionvector indicating the reference block derived by the above-describedmotion estimation may be used as the motion vector of the current block,and an mvp candidate having a motion vector having the smallestdifference from the motion vector of the current block among the mvpcandidates may be the selected mvp candidate. A motion vector difference(MVD), which is a difference obtained by subtracting mvp from the motionvector of the current block, may be derived. In this case, informationon the MVD may be signaled to the decoding apparatus. In addition, whenthe (A)MVP mode is applied, the value of the reference picture index maybe separately signaled to the decoding apparatus by constructing thereference picture index information.

The encoding apparatus may derive residual samples based on predictionsamples (S410). The encoding apparatus may derive residual samples bycomparing original samples of the current block with prediction samples.

The encoding apparatus encodes image information including predictioninformation and residual information (S420). The encoding apparatus mayoutput encoded image information in the form of a bitstream. Theprediction information is information related to the predictionprocedure and may include prediction mode information (eg, skip flag,merge flag, or mode index, etc.) and motion information. The informationon the motion information may include candidate selection information(eg, merge index) that is information for deriving a motion vector.Also, the information on the motion information may include informationindicating whether L0 prediction, L1 prediction, or bi-prediction isapplied. The residual information is information on residual samples.The residual information may include information on quantized transformcoefficients for residual samples.

The output bitstream may be stored in a (digital) storage medium andtransmitted to the decoding apparatus, or may be transmitted to thedecoding apparatus through a network.

Also, as described above, the encoding apparatus may generate areconstructed picture (including reconstructed samples and areconstructed block) based on reference samples and residual samples.This is because the encoding apparatus may derive the same predictionresult as that performed in the decoding apparatus, and through this,coding efficiency may be increased. Accordingly, the encoding apparatusmay store reconstructed pictures (or reconstructed samples,reconstructed blocks) in a memory and use the stored reconstructedpictures as reference pictures for inter-prediction. As described above,an in-loop filtering procedure or the like may be further applied to thereconstructed picture.

FIG. 6 illustrates an example of a video/image decoding method based oninter-prediction, and FIG. 7 is an example schematically illustrating aninter-prediction unit in a decoding apparatus. The inter-prediction unitin the decoding apparatus of FIG. 7 may be applied to be identical to orcorresponding to an inter-prediction unit 332 of a decoding apparatus300 of FIG. 3 described above.

Referring to FIGS. 6 and 7, the decoding apparatus may perform anoperation corresponding to the operation performed by the encodingapparatus. The decoding apparatus may perform prediction on the currentblock based on the received prediction information and derive predictionsamples.

Specifically, the decoding apparatus may determine the prediction modefor the current block based on the received prediction information(S600). The decoding apparatus may determine which inter-prediction modeis applied to the current block based on prediction mode information inthe prediction information.

Inter-prediction mode candidates may include a skip mode, a merge mode,and/or a (A)MVP mode, or may include various inter-prediction modes.

The decoding apparatus derives motion information of the current blockbased on the determined inter-prediction mode (S610). For example, whenthe skip mode or the merge mode is applied to the current block, thedecoding apparatus may construct a merge candidate list, and select onemerge candidate from among merge candidates included in the mergecandidate list. Here, the selection may be performed based on theabove-described selection information (merge index). The motioninformation of the current block may be derived using motion informationof the selected merge candidate. The motion information of the selectedmerge candidate may be used as the motion information of the currentblock.

As another example, when the (A)MVP mode is applied to the currentblock, the decoding apparatus may construct a (A)MVP candidate list, andmay use a motion vector of an mvp candidate selected from among motionvector predictor (mvp) candidates included in the (A)MVP candidate listas the mvp of the current block. Here, the selection may be performedbased on the above-described selection information (mvp flag or mvpindex). In this case, the MVD of the current block may be derived basedon the information on the MVD, and the motion vector of the currentblock may be derived based on the mvp and MVD of the current block.Also, the reference picture index of the current block may be derivedbased on the reference picture index information. The picture indicatedby the reference picture index in the reference picture list for thecurrent block may be derived as the reference picture referenced for theinter-prediction of the current block.

Meanwhile, the motion information of the current block may be derivedwithout constructing a candidate list, and in this case, the motioninformation of the current block may be derived according to theprocedure disclosed in the prediction mode. In this case, the candidatelist configuration as described above may be omitted.

The decoding apparatus may generate prediction samples for the currentblock based on motion information of the current block (S620). In thiscase, the reference picture may be derived based on the referencepicture index of the current block, and the prediction samples of thecurrent block may be derived using samples of the reference blockindicated by the motion vector of the current block on the referencepicture. In this case, in some cases, a prediction sample filteringprocedure for all or some of the prediction samples of the current blockmay be further performed.

For example, the inter-prediction unit 332 of the decoding apparatus mayinclude a prediction mode determiner 332_1, a motion informationderivation unit 332_2, and a prediction sample derivation unit 332_3,and the prediction mode determiner 332_1 may determine the predictionmode for the current block based on the received prediction modeinformation, the motion information derivation unit 332_2 may derivemotion information (motion vector and/or reference picture index, etc.)of the current block based on the received motion informationinformation, and the prediction sample derivation unit 332_3 may deriveprediction samples of the current block.

The decoding apparatus generates residual samples for the current blockbased on the received residual information (S630). The decodingapparatus may generate reconstructed samples for the current block basedon prediction samples and residual samples, and generate a reconstructedpicture based thereon (S640). Thereafter, as described above, an in-loopfiltering procedure may be further applied to the reconstructed picture.

As described above, the inter-prediction procedure may include the stepof determining the inter-prediction mode, the step of deriving motioninformation according to the determined prediction mode, and the step ofperforming prediction (generating of the prediction sample) based on thederived motion information. The inter-prediction procedure may beperformed in the encoding apparatus and the decoding apparatus asdescribed above.

Meanwhile, in deriving the motion information of the current block, themotion information candidate(s) are derived based on the spatialneighboring block(s) and the temporal neighboring block(s), and based onthe derived motion information candidate(s), the current A motioninformation candidate for a block may be selected. In this case, theselected motion information candidate may be used as the motioninformation of the current block.

FIG. 8 is a diagram for describing a merge mode in inter-prediction.

When the merge mode is applied, motion information on the currentprediction block is not directly transmitted, but the motion informationon the current prediction block is derived using motion information on aneighboring prediction block. Accordingly, the motion information on thecurrent prediction block may be indicated by transmitting flaginformation indicating that the merge mode is used and a merge indexindicating which prediction block in the vicinity is used. The mergemode may be referred to as a regular merge mode. For example, the mergemode may be applied when a value of a regular_merge_flag syntax elementis 1.

In order to perform the merge mode, the encoding apparatus needs tosearch for a merge candidate block used to derive motion information onthe current prediction block. For example, up to five merge candidateblocks may be used, but the embodiment(s) of the present disclosure arenot limited thereto. In addition, the maximum number of merge candidateblocks may be transmitted in a slice header or a tile group header, butthe embodiment(s) of the present disclosure are not limited thereto.After finding the merge candidate blocks, the encoding apparatus maygenerate a merge candidate list, and may select a merge candidate blockhaving the smallest cost among the merge candidate blocks as a finalmerge candidate block.

The present disclosure may provide various embodiments of mergecandidate blocks constituting the merge candidate list.

For example, the merge candidate list may use five merge candidateblocks. For example, four spatial merge candidates and one temporalmerge candidate may be used. As a specific example, in the case of thespatial merge candidate, blocks illustrated in FIG. 8 may be used as thespatial merge candidates. Hereinafter, the spatial merge candidate or aspatial MVP candidate to be described later may be referred to as anSMVP, and the temporal merge candidate or a temporal MVP candidate to bedescribed later may be referred to as a TMVP.

The merge candidate list for the current block may be constructed, forexample, based on the following procedure.

The coding apparatus (encoding apparatus/decoding apparatus) may searchfor spatially neighboring blocks of the current block and insert thederived spatial merge candidates into the merge candidate list. Forexample, the spatial neighboring blocks may include bottom-left cornerneighboring blocks, left neighboring blocks, top-right cornerneighboring blocks, top-left corner neighboring blocks, and top-leftcorner neighboring blocks of the current block. However, this is anexample, and in addition to the spatial neighboring blocks describedabove, additional neighboring blocks such as a right neighboring block,a bottom neighboring block, and a bottom-right neighboring block may befurther used as the spatial neighboring blocks. The coding apparatus maydetect available blocks by searching for the spatially neighboringblocks based on priority, and may derive motion information on thedetected blocks as the spatial merge candidates. For example, theencoding apparatus or the decoding apparatus may be configured tosequentially search for five blocks illustrated in FIG. 8 in an ordersuch as A₁→B₁→B₀→A₀→B₂, and may sequentially index available candidatesto constitute the merge candidate list.

The coding apparatus may search for temporal neighboring blocks of thecurrent block and insert a derived temporal merge candidate into themerge candidate list. The temporal neighboring block may be positionedat a reference picture that is a different picture from the currentpicture in which the current block is positioned. The reference picturein which the temporal neighboring blocks are positioned may be called acollocated picture or a col picture. The temporal neighboring blocks maybe searched for in the order of the bottom-right corner neighboringblock and the bottom-right center block of the co-located block withrespect to the current block on the col picture. Meanwhile, when motiondata compression is applied, specific motion information may be storedas representative motion information on each predetermined storage unitin the col picture. In this case, there is no need to store motioninformation on all blocks in the predetermined storage unit, and throughthis, a motion data compression effect may be obtained. In this case,the predetermined storage unit may be predetermined as, for example,units of 16×16 samples or units of 8×8 samples, or size information onthe predetermined storage unit may be signaled from the encodingapparatus to the decoding apparatus. When the motion data compression isapplied, the motion information on the temporally neighboring blocks maybe replaced with representative motion information on the predeterminedstorage unit in which the temporally neighboring blocks are positioned.That is, in this case, from an implementation point of view, instead ofthe predicted block positioned at the coordinates of the temporallyneighboring blocks, the temporal merge candidate may be derived based onthe motion information on the prediction block covering the arithmeticleft shifted position after arithmetic right shift by a certain valuebased on the coordinates (top-left sample position) of the temporalneighboring block. For example, when the predetermined storage unit isunits of 2n×2n samples, if the coordinates of the temporally neighboringblocks are (xTnb, yTnb), the motion information on the prediction blockpositioned at the corrected position ((xTnb>>n)<<n), (yTnb>>n)<<n)) maybe used for the temporal merge candidate. Specifically, when thepredetermined storage unit is units of 16×16 samples, if the coordinatesof the temporally neighboring blocks are (xTnb, yTnb), the motioninformation on the prediction block positioned at the corrected position((xTnb>>4)<<4), (yTnb>>4)<<4)) may be used for the temporal mergecandidate. Alternatively, when the predetermined storage unit is unitsof 8×8 samples, if the coordinates of the temporally neighboring blocksare (xTnb, yTnb), the motion information on the prediction blockpositioned at the corrected position ((xTnb>>3)<<3), (yTnb>>3)<<3)) maybe used for the temporal merge candidate.

The coding apparatus may check whether the number of current mergecandidates is smaller than the number of maximum merge candidates. Themaximum number of merge candidates may be predefined or signaled fromthe encoding apparatus to the decoding apparatus. For example, theencoding apparatus may generate and encode information on the maximumnumber of merge candidates, and transmit the information to the decoderin the form of a bitstream. When the maximum number of merge candidatesis filled, the subsequent candidate addition process may not proceed.

As a result of the check, when the number of the current mergecandidates is smaller than the maximum number of merge candidates, thecoding apparatus may insert an additional merge candidate into the mergecandidate list. For example, the additional merge candidates may includeat least one of a history based merge candidate(s), pair-wise averagemerge candidate(s), ATMVP, a combined bi-predictive merge candidate(when the slice/tile group type of the current slice/tile group is typeB) and/or a zero vector merge candidate which will be described later.

As a result of the check, when the number of the current mergecandidates is not smaller than the maximum number of merge candidates,the coding apparatus may terminate the construction of the mergecandidate list. In this case, the encoding apparatus may select anoptimal merge candidate from among the merge candidates constituting themerge candidate list based on rate-distortion (RD) cost, and signalselection information indicating the selected merge candidate (ex. mergeindex) to the decoding apparatus. The decoding apparatus may select theoptimal merge candidate based on the merge candidate list and theselection information.

As described above, the motion information on the selected mergecandidate may be used as the motion information on the current block,and prediction samples of the current block may be derived based on themotion information on the current block. The encoding apparatus mayderive residual samples of the current block based on the predictionsamples, and may signal residual information on the residual samples tothe decoding apparatus. As described above, the decoding apparatus maygenerate reconstructed samples based on residual samples derived basedon the residual information and the prediction samples, and may generatea reconstructed picture based thereon.

When the skip mode is applied, the motion information on the currentblock may be derived in the same way as when the merge mode is applied.However, when the skip mode is applied, the residual signal for thecorresponding block is omitted, and thus the prediction samples may bedirectly used as the reconstructed samples. The skip mode may beapplied, for example, when the value of the cu_skip_flag syntax elementis 1.

Meanwhile, the pair-wise average merge candidate may be referred to as apair-wise average candidate or a pair-wise candidate. The pair-wiseaverage candidate(s) may be generated by averaging pairs of predefinedcandidates in an existing merge candidate list. In addition, predefinedpairs may be defined as {(0, 1), (0, 2), (1, 2), (0, 3), (1, 3), (2,3)}. Here, the numbers may indicate merge indices for the mergecandidate list. An averaged motion vector may be calculated separatelyfor each reference list. For example, when two motion vectors areavailable in one list, the two motion vectors may be averaged even ifthey point to different reference pictures. For example, when only onemotion vector is available, one motion vector may be used directly. Forexample, when there are no motion vectors available, the list may remaininvalid.

For example, when the merge candidate list is not full even afterpair-wise average merge candidates are added, that is, when the numberof current merge candidates in the merge candidate list is smaller thanthe number of maximum merge candidates, a zero vector (zero MVP) may beinserted last until the maximum merge candidate number appears. That is,a zero vector may be inserted until the number of current mergecandidates in the merge candidate list becomes the maximum number ofmerge candidates.

Meanwhile, conventionally, only one motion vector could be used torepresent the motion of a coding block. That is, a translational motionmodel could be used. However, although this method may represent anoptimal motion in units of blocks, it is not actually an optimal motionof each sample, and coding efficiency may be increased if an optimalmotion vector may be determined in units of samples. To this end, anaffine motion model may be used. An affine motion prediction method forcoding using an affine motion model may be as follows.

The affine motion prediction method may represent a motion vector inunits of each sample of a block using two, three, or four motionvectors. For example, the affine motion model may represent four typesof motion. The affine motion model, which represents three motions(translation, scale, and rotation) among the motions that the affinemotion model may represent, may be called a similarity (or simplified)affine motion model. However, the affine motion model is not limited tothe above-described motion model.

FIGS. 9A and 9B are diagram exemplarily illustrating CPMV for affinemotion prediction.

The affine motion prediction may determine a motion vector of a sampleposition included in a block using two or more control point motionvectors (CPMV). In this case, a set of motion vectors may be referred toas an affine motion vector field (MVF).

For example, FIG. 9A may show a case in which two CPMVs are used, whichmay be referred to as a 4-parameter affine model. In this case, themotion vector at the (x, y) sample position may be determined as, forexample, Equation (1).

$\begin{matrix}\left\{ \begin{matrix}{{mv}_{x} = {{\frac{{m\nu_{1x}} - {m\nu_{0x}}}{W}x} + {\frac{{m\nu_{1y}} - {m\nu_{0y}}}{W}y} + {m\nu_{0x}}}} \\{{mv_{y}} = {{\frac{{m\nu_{1y}} - {m\nu_{0y}}}{W}x} + {\frac{{m\nu_{1x}} - {m\nu_{0x}}}{W}y} + {m\nu_{0y}}}}\end{matrix} \right. & \left\lbrack {{Equation}\mspace{14mu} 1} \right\rbrack\end{matrix}$

For example, FIG. 9B may illustrates a case in which three CPMVs areused, which may be referred to as a 6-parameter affine model. In thiscase, the motion vector at the (x, y) sample position may be determinedas, for example, Equation (2).

$\begin{matrix}\left\{ \begin{matrix}{{mv_{x}} = {{\frac{{m\nu_{1x}} - {m\nu_{0x}}}{W}x} + {\frac{{m\nu_{2x}} - {m\nu_{0x}}}{H}y} + {mv_{0x}}}} \\{{mv_{y}} = {{\frac{{m\nu_{1y}} - {m\nu_{0y}}}{W}x} + {\frac{{m\nu_{2y}} - {mv_{0y}}}{H}y} + {mv}_{0y}}}\end{matrix} \right. & \left\lbrack {{Equation}\mspace{14mu} 2} \right\rbrack\end{matrix}$

In Equations 1 and 2, {v_(x), v_(y)} may represent a motion vector atthe (x, y) position. In addition, {v0_(x), v0_(y)} may indicate the CPMVof a control point (CP) at the top-left corner position of the codingblock, and {v1_(x), v1_(y)} may indicate the CPMV of the CP at thetop-right corner position, {v2_(x), v2_(y)} may indicate the CPMV of theCP at the bottom-left corner position. In addition, W may indicate awidth of the current block, and H may indicate a height of the currentblock.

FIG. 10 is a diagram exemplarily illustrating a case in which an affineMVF is determined in units of subblocks.

In the encoding/decoding process, the affine MVF may be determined inunits of samples or in units of subblocks previously defined. Forexample, when determining in units of samples, a motion vector may beobtained based on each sample value. Alternatively, for example, whendetermining in units of subblocks, the motion vector of thecorresponding block may be obtained based on the sample value of thecenter of the subblock (that is, the bottom-right of the center, thatis, the bottom-right sample among the four samples in the center). Thatis, in affine motion prediction, the motion vector of the current blockmay be derived in units of samples or subblocks.

In the case of FIG. 10, the affine MVF is determined in a 4×4 subblockunit, but the size of the subblocks may be variously modified.

That is, when the affine prediction is available, three motion modelsapplicable to the current block may include a translational motionmodel, a 4-parameter affine motion model, and a 6-parameter affinemotion model. Here, the translational motion model may represent a modelin which the existing block unit motion vector is used, the 4-parameteraffine motion model may represent a model in which two CPMVs are used,and the 6-parameter affine motion model may represent a model in whichthree CPMVs are used.

Meanwhile, the affine motion prediction may include an affine MVP (oraffine inter) mode or an affine merge mode.

FIG. 11 is a diagram for describing an affine merge mode ininter-prediction.

For example, in the affine merge mode, the CPMV may be determinedaccording to the affine motion model of the neighboring block coded bythe affine motion prediction. For example, neighboring blocks coded asaffine motion prediction in search order may be used for affine mergemode. That is, when at least one of neighboring blocks is coded in theaffine motion prediction, the current block may be coded in the affinemerge mode. Here, the fine merge mode may be called AF_MERGE.

When the affine merge mode is applied, the CPMVs of the current blockmay be derived using CPMVs of neighboring blocks. In this case, theCPMVs of the neighboring block may be used as the CPMVs of the currentblock as they are, and the CPMVs of the neighboring block may bemodified based on the size of the neighboring block and the size of thecurrent block and used as the CPMVs of the current block.

On the other hand, in the case of the affine merge mode in which themotion vector (MV) is derived in units of subblocks, it may be called asubblock merge mode, which may be indicated based on a subblock mergeflag (or a merge_subblock_flag syntax element). Alternatively, when thevalue of the merge_subblock_flag syntax element is 1, it may beindicated that the subblock merge mode is applied. In this case, anaffine merge candidate list to be described later may be called asubblock merge candidate list. In this case, the subblock mergecandidate list may further include a candidate derived by SbTMVP, whichwill be described later. In this case, the candidate derived by theSbTMVP may be used as a candidate of index 0 of the subblock mergecandidate list. In other words, the candidate derived from the SbTMVPmay be positioned before an inherited affine candidate or a constructedaffine candidate to be described later in the subblock merge candidatelist.

When the affine merge mode is applied, the affine merge candidate listmay be constructed to derive CPMVs for the current block. For example,the affine merge candidate list may include at least one of thefollowing candidates. 1) An inherited affine merge candidate. 2)Constructed affine merge candidate. 3) Zero motion vector candidate (orzero vector). Here, the inherited affine merge candidate is a candidatederived based on the CPMVs of the neighboring block when the neighboringblock is coded in affine mode, the constructed affine merge candidate isa candidate derived by constructing the CPMVs based on the MVs ofneighboring blocks of the corresponding CP in units of each CPMV, andthe zero motion vector candidate may indicate a candidate composed ofCPMVs whose value is 0.

The affine merge candidate list may be constructed as follows, forexample.

There may be up to two inherited affine candidates, and the inheritedaffine candidates may be derived from affine motion models ofneighboring blocks. Neighboring blocks can contain one left neighboringblock and an upper neighboring block. The candidate blocks may bepositioned as illustrated in FIG. 4. A scan order for a left predictormay be A₁→A₀, and a scan order for the upper predictor may be B₁→B₀→B₂.Only one inherited candidate from each of the left and top may beselected. A pruning check may not be performed between two inheritedcandidates.

When the neighboring affine block is checked, the control point motionvectors of the checked block may be used to derive a CPMVP candidate inthe affine merge list of the current block. Here, the neighboring affineblock may indicate a block coded in the affine prediction mode amongneighboring blocks of the current block. For example, referring to FIG.7, when a bottom-left neighboring block A is coded in the affineprediction mode, motion vectors v2, v3, and v4 of a top-left (top-left)corner, a top-right corner, and a bottom-left corner of the neighboringblock A may be acquired. When the neighboring block A is coded with a4-parameter affine motion model, two CPMVs of the current block may becalculated according to v2 and v3. When the neighboring block A is codedwith a 6-parameter affine motion model, two CPMVs of the current blockmay be calculated according to v2, v3, and v4.

FIG. 12 is a diagram for describing positions of candidates in an affinemerge mode.

The constructed affine candidate may mean a candidate constructed bycombining translational motion information around each control point.The motion information on the control points may be derived fromspecified spatial and temporal perimeters. CPMVk (k=0, 1, 2, 3) mayrepresent a k^(th) control point.

Referring to FIG. 12, blocks may be checked in the order of B₂→B₃→A₂ forCPMV0, and a motion vector of a first available block may be used. ForCPMV1, blocks may be checked according to the order of B₁→B0, and forCPMV2, blocks may be checked according to the order of A₁→A₀. A temporalmotion vector predictor (TVMP) may be used with CPMV3 if available.

After motion vectors of four control points are obtained, the affinemerge candidates may be generated based on the acquired motioninformation. The combination of the control point motion vectors maycorrespond to any one of {CPMV0, CPMV1, CPMV2}, {CPMV0, CPMV1, CPMV3},{CPMV0, CPMV2, CPMV3}, {CPMV1, CPMV2, CPMV3}, {CPMV0, CPMV1}, and{CPMV0, CPMV2}.

A combination of three CPMVs may constitute a 6-parameter affine mergecandidate, and a combination of two CPMVs may constitute a 4-parameteraffine merge candidate. In order to avoid the motion scaling process,when the reference indices of the control points are different, therelevant combinations of the control point motion vectors may bediscarded.

FIG. 13 is a diagram for describing SbTMVP in inter-prediction.

Meanwhile, the subblock-based temporal motion vector prediction (SbTMVP)method may also be used. For example, the SbTMVP may be called advancedtemporal motion vector prediction (ATMVP). The SbTMVP may use a motionfield in a collocated picture to improve motion vector prediction andmerge mode for CUs in the current picture. Here, the collocated picturemay be called a col picture.

For example, the SbTMVP may predict motion at a subblock (or sub-CU)level. In addition, the SbTMVP may apply a motion shift before fetchingthe temporal motion information from the col picture. Here, the motionshift may be acquired from a motion vector of one of spatiallyneighboring blocks of the current block.

The SbTMVP may predict the motion vector of a subblock (or sub-CU) inthe current block (or CU) according to two steps.

In the first step, the spatially neighboring blocks may be testedaccording to the order of A₁, B₁, B₀ and A₀ in FIG. 4. A first spatialneighboring block having a motion vector using a col picture as itsreference picture may be checked, and the motion vector may be selectedas a motion shift to be applied. When such a motion is not checked fromspatially neighboring blocks, the motion shift may be set to (0, 0).

In the second step, the motion shift checked in the first step may beapplied to obtain sub-block level motion information (motion vector andreference indices) from the col picture. For example, the motion shiftmay be added to the coordinates of the current block. For example, themotion shift may be set to the motion of A₁ of FIG. 8. In this case, foreach subblock, the motion information on a corresponding block in thecol picture may be used to derive the motion information on thesubblock. The temporal motion scaling may be applied to align referencepictures of temporal motion vectors with reference pictures of thecurrent block.

The combined subblock-based merge list including both the SbTVMPcandidates and the affine merge candidates may be used for signaling ofthe affine merge mode. Here, the affine merge mode may be referred to asa subblock-based merge mode. The SbTVMP mode may be available orunavailable according to a flag included in a sequence parameter set(SPS). When the SbTMVP mode is available, the SbTMVP predictor may beadded as the first entry of the list of subblock-based merge candidates,and the affine merge candidates may follow. The maximum allowable sizeof the affine merge candidate list may be five.

The size of the sub-CU (or subblock) used in the SbTMVP may be fixed to8×8, and as in the affine merge mode, the SbTMVP mode may be appliedonly to blocks having both a width and a height of 8 or more. Theencoding logic of the additional SbTMVP merge candidate may be the sameas that of other merge candidates. That is, for each CU in the P or Bslice, an RD check using an additional rate-distortion (RD) cost may beperformed to determine whether to use the SbTMVP candidate.

Meanwhile, the predicted block for the current block may be derivedbased on the motion information derived according to the predictionmode. The predicted block may include prediction samples (predictionsample array) of the current block. When the motion vector of thecurrent block indicates a fractional sample unit, an interpolationprocedure may be performed. Through this, the prediction samples of thecurrent block may be derived based on the fractional sample unitreference samples in the reference picture. When the affineinter-prediction (affine prediction mode) is applied to the currentblock, the prediction samples may be generated based on asample/subblock unit MV. When the bi-prediction is applied, theprediction samples may be used as the prediction samples of the currentblock derived through a weighted sum or weighted average (according to aphase) of the prediction samples derived based on the L0 prediction (ie,prediction using the reference picture and MVL0 in the reference picturelist L0) and the prediction samples derived based on the L1 prediction(ie, prediction using the reference picture and MVL1 in the referencepicture list L1). Here, the motion vector in the L0 direction may bereferred to as an L0 motion vector or MVL0, and the motion vector in theL1 direction may be referred to as an L1 motion vector or MVL1. In thecase where the bi-prediction is applied, when the reference picture usedfor the L0 prediction and the reference picture used for the L1prediction are positioned in different temporal directions with respectto the current picture (that is, case corresponding to the bidirectionaldirection or bi-prediction), which may be called a true bi-prediction.

Also, as described above, reconstructed samples and reconstructedpictures may be generated based on the derived prediction samples, andthen procedures such as in-loop filtering may be performed.

Meanwhile, when the bi-prediction is applied to the current block, theprediction samples may be derived based on a weighted average. Forexample, the bi-prediction using the weighted average may be calledbi-prediction with CU-level weight (BCW), bi-prediction with weightedAverage (BWA), or weighted averaging bi-prediction.

Conventionally, the bi-prediction signal (ie, bi-prediction samples) maybe derived through a simple average of the L0 prediction signal (L0prediction samples) and the L1 prediction signals. That is, thebi-prediction samples are derived as an average of the L0 predictionsamples based on the L0 reference picture and MVL0 and the L1 predictionsamples based on the L1 reference picture and MVL1. However, when thebi-prediction is applied, the bi-prediction signal (bi-predictionsamples) may be derived through the weighted average of the L0prediction signal and the L1 prediction signal as follows. For example,the bi-prediction signals (bi-prediction samples) may be derived as inEquation 3.

$\begin{matrix}{P_{{bi}\text{-}{pred}} = {\left( {{\left( {8 - w} \right)*P_{0}} + {w*P_{1}} + 4} \right) ⪢ 3}} & \left\lbrack {{Equation}\mspace{14mu} 3} \right\rbrack\end{matrix}$

In Equation 3, Pbi-pred may indicate a value of a bi-prediction signal,that is, a prediction sample value derived by applying bi-prediction,and w may indicate a weight. In addition, P0 may indicate the value ofthe L0 prediction signal, that is, the prediction sample value derivedby applying the L0 prediction, and P1 may indicate the value of the L1prediction signal, ie, the prediction sample value derived by applyingthe L1 prediction.

For example, 5 weights may be allowed in the weighted averagebi-prediction. For example, the five weights w may include −2, 3, 4, 5,or 10. That is, the weight w may be determined as one of weightcandidates including −2, 3, 4, 5, or 10. For each CU to which thebi-prediction is applied, the weight w may be determined by one of twomethods. In the first method, the weight index may be signaled after amotion vector difference for an unmerged CU. In the second method, aweight index for a merged CU may be inferred from neighboring blocksbased on a merge candidate index.

For example, the weighted average bi-prediction may be applied to a CUhaving 256 or more luma samples. That is, when the product of the widthand height of the CU is greater than or equal to 256, the weightedaverage bi-prediction may be applied. In the case of a low-delay(low-delay) picture, five weights may be used, and in the case of anon-low-delay picture, three weights may be used. For example, the threeweights may include 3, 4 or 5.

For example, in the encoding apparatus, a fast search algorithm may beapplied to find a weight index without significantly increasing thecomplexity of the encoding apparatus. This algorithm may be summarizedas follows. For example, when the current picture is a low-delay picturewhen combined with adaptive motion vector resolution (AMVR) (when AMVRis used as inter-prediction mode), unequal weights may be conditionallychecked for 1-pel and 4-pel motion vector precision. For example, whencombined with affine (when the affine prediction mode is used as theinter-prediction mode), in the case where the affine prediction mode iscurrently selected as the best mode, the affine motion estimation (ME)may be performed on unequal weights. For example, when two referencepictures of bi-prediction are the same, unequal weights may beconditionally checked. For example, when a specific condition issatisfied depending on a POC distance between the current picture and areference picture, a coding quantization parameter (QP), and a temporallevel, unequal weights may not be searched.

For example, the BCW weight index may be coded using one context codedbin followed by a bypass coded bin. The first context coded bin mayindicate whether the same weight is used. When the unequal weights areused based on the first context coded bin, additional bins may besignaled using bypass coding to indicate unequal weights to be used.

Meanwhile, when the bi-prediction is applied, weight information used togenerate prediction samples may be derived based on weight indexinformation on a candidate selected from among candidates included inthe merge candidate list.

According to an embodiment of the present disclosure, when constructinga motion vector candidate for a merge mode, weight index information ona temporal motion vector candidate may be derived as follows. Forexample, when a temporal motion vector candidate uses bi-prediction,weight index information on a weighted average may be derived. That is,when the inter-prediction type is bi-prediction, weight indexinformation (or a temporal motion vector candidate) on a temporal mergecandidate in the merge candidate list may be derived.

For example, weight index information on a weighted average with respectto a temporal motion vector candidate may always be derived as 0. Here,the weight index information of 0 may mean that the weights of eachreference direction (ie, the L0 prediction direction and the L1prediction direction in bi-prediction) are the same. For example, aprocedure for deriving a motion vector of a luma component for the mergemode may be shown in the Table below.

TABLE 1 8.4.2.2 Derivation process for luma motion vectors for mergemode This process is only invoked when merge_flag[ xCb ][ yPb ] is equalto 1, where ( xCb, yCb ) specify the top- left sample of the currentluma coding block relative to the top-left luma sample of the currentpicture. Inputs to this process are: - a luma location ( xCb, yCb ) ofthe top-left sample of the current luma coding block relative to thetop- left luma sample of the current picture, - a variable cbWidthspecifying the width of the current coding block in luma samples, - avariable cbHeight specifying the height of the current coding block inluma samples. Outputs of this process are: - the luma motion vectors in1/16 fractional-sample accuracy mvL0[ 0 ][ 0 ] and mvL1[ 0 ][ 0 ], - thereference indices refIdxL0 and refIdxL1, - the prediction listutilization flags predFlagL0[ 0 ][ 0 ] and predFlagL1[ 0 ][ 0 ], - thebi-prediction weight index gbiIdx. The bi-prediction weight index gbiIdxis set equal to 0. The motion vectors mvL0[ 0 ][ 0 ] and mvL1[ 0 ][ 0 ],the reference indices refIdxL0 and refIdxL1 and the predictionutilization flags predFlagL0[ 0 ][ 0 ] and predFlagL1[ 0 ][ 0 ] arederived by the following ordered steps:  1. The derivation process formerging candidates from neighbouring coding units as specified in clause8.4.2.3 is invoked with the luma coding block location ( xCb, yCb ), theluma coding block width cbWidth, and the luma coding block heightcbHeight as inputs, and the output being the availability flagsavailableFlagA₀, availableFlagA₁, availableFlagB₀, availableFlagB₁ andavailableFlagB₂, the reference indices refIdxLXA₀, refIdxLXA₁,refIdxLXB₀, refIdxLXB₁ and refIdxLXB₂, the prediction list utilizationflags predFlagLXA₀, predFlagLXA₁, predFlagLXB₀, predFlagLXB₁ andpredFlagLXB₂, and the motion vectors mvLXA₀, mvLXA₁, mvLXB₀, mvLXB₁ andmvLXB₂, with X being 0 or 1, and the bi-prediction weight indicesgbiIdxA₀, gbiIdxA₁, gbiIdxB₀, gbiIdxB₁, gbiIdxB₂,  2. The referenceindices, refIdxLXCol, with X being 0 or 1, and the bi-prediction weightindex gbiIdxCol for the temporal merging candidate Col are set equal to0.  3. The derivation process for temporal luma motion vector predictionas specified in in clause 8.4.2.11 is invoked with the luma location (xCb, yCb ), the luma coding block width cbWidth, the luma coding blockheight cbHeight and the variable refIdxL0Col as inputs, and the outputbeing the availability flag availableFlagL0Col and the temporal motionvector mvL0Col. The variables availableFlagCol, predFlagL0Col andpredFlagL1Col are derived as follows: availableFlagCol =availableFlagL0Col (8-283) predFlagL0Col = availableFlagL0Col (8-284)predFlagL1Col = 0 (8-285) gbiIdxCol = 0 (8-xxx)  4. When tile_group_typeis equal to B, the derivation process for temporal luma motion vectorprediction as specified in clause 8.4.2.11 is invoked with the lumalocation ( xCb, yCb ), the luma coding block width cbWidth, the lumacoding block height cbHeight and the vanable refIdxL1Col as inputs, andthe output being the availability flag availableFlagL1Col and thetemporal motion vector mvL1Col. The variables availableFlagCol andpredFlagL1Col are derived as follows: availableFlagCol =availableFlagL0Col | | availableFlagL1Col (8-286) predFlagL1Col =availableFlagL1Col (8-287)  5. The merging candidate list,mergeCandList, is constructed as follows: i = 0 if( availableFlagA₁ )mergeCandList[ i++ ] = A₁ if( availableFlagB₁ ) mergeCandList[ i++ ] =B₁ if( availableFlagB₀ ) mergeCandList[ i++ ] = B₀ (8-288) if(availableFlagA₀ ) mergeCandList[ i++ ] = A₀ if( availableFlagB₂ )mergeCandList[ i++ ] = B₂ if( availableFlagCol ) mergeCandList[ i++ ] =Col  6. The variable numCurrMergeCand and numOrigMergeCand are set equalto the number of merging candidates in the mergeCandList.  7. WhennumCurrMergeCand is less than (MaxNumMergeCand − 1) and NumHmvpCand isgreater than 0, the following applies: - The derivation process ofhistory-based merging candidates as specified in 8.4.2.6 is invoked withmergeCandList, and numCurrMergeCand as inputs, and modifiedmergeCandList and numCurrMergeCand as outputs. - numOrigMergeCand is setequal to numCurrMergeCand.  8. The derivation process for pairwiseaverage merging candidates specified in clause 8.4.2.4 is invoked withmergeCandList, the reference indices refIdxL0N and refIdxL1N, theprediction list utilization flags predFlagL0N and predFlagL1N, themotion vectors mvL0N and mvL1N of every candidate N in mergeCandList,numCurrMergeCand and numOrigMergeCand as inputs, and the output isassigned to mergeCandList, numCurrMergeCand, the reference indicesrefIdxL0avgCand_(k) and refIdxL1avgCand_(k), the prediction listutilization flags predFlagL0avgCand_(k) and predFlagL1avgCand_(k) andthe motion vectors mvL0avgCand_(k) and mvL1avgCand_(k) of every newcandidate avgCand_(k) being added into mergeCandList. The bi-predictionweight index gbiIdx of every new candidate avgCand_(k) being added intomergeCandList is set equal to 0. The number of candidates being added,numAvgMergeCand, is set equal to ( numCurrMergeCand − numOrigMergeCand). When numAvgMergeCand is greater than 0, k ranges from 0 tonumAvgMergeCand − 1, inclusive.  9. The derivation process for zeromotion vector merging candidates specified in clause 8.4.2.5 is invokedwith the mergeCandList, the reference indices refIdxL0N and refIdxL1N,the prediction list utilization flags predFlagL0N and predFlagL1N, themotion vectors mvL0N and mvL1N of every candidate N in mergeCandList andnumCurrMergeCand as inputs, and the output is assigned to mergeCandList,numCurrMergeCand, the reference indices refIdxL0zeroCand_(m) andrefIdxL1zeroCand_(m), the prediction list utilization flagspredFlagL0zeroCand_(m) and predFlagL1zeroCand_(m) and the motion vectorsmvL0zeroCand_(m) and mvL1zeroCand_(m) of every new candidatezeroCand_(m) being added into mergeCandList. The bi-prediction weightindex gbiIdx of every new candidate zeroCand_(m) being added intomergeCandList is set equal to 0. The number of candidates being added,numZeroMergeCand, is set equal to ( numCurrMergeCand − numOrigMergeCand− numAvgMergeCand ). When numZeroMergeCand is greater than 0, m rangesfrom 0 to numZeroMergeCand − 1, inclusive. 10. The variablemergeIdxOffset is set equal to 0. 11. When mmvd_flag[ xCb ][ yCb ] isequal to 1, the variable mmvdCnt is set equal, to 0 and tThe followingapplies until mmvdCnt is greater than ( merge_idx[ xCb ][ yCb ] +mergeIdxOffset ) or mmvdCnt is equal to MaxNumMergeCand: - Whencandidate mergeCandList[ mmvdCnt ] uses the current decoded picture asits reference picture, mergeIdxOffset is incremented by 1. - Thevariable mmvdCnt is incremented by 1. 12. The following assignments aremade with N being the candidate at position merge_idx[ xCb ][ yCb ] +mergeIdxOffset in the merging candidate list mergeCandList ( N =mergeCandList[ merge_idx[ xCb ][ yCb ] + mergeIdxOffset ] ) and X beingreplaced by 0 or 1: refIdxLX = refIdxLXN (8-289) predFlagLX[ 0 ][ 0 ] =predFlagLXN (8-290) mvLX[ 0 ][ 0 ][ 0 ] = mvLXN[ 0 ] (8-291) mvLX[ 0 ][0 ][ 1 ] = mvLXN[ 1 ] (8-292) gbiIdx = gbiIdxN (8-293) 13. Whenmmvd_flag[ xCb ][ yCb ] is equal to 1, the following applies: - Thederivation process for merge motion vector difference as specified in8.4.2.7 is invoked with the luma location ( xCb, yCb ), the luma motionvectors mvL0[ 0 ][ 0 ], mvL1[ 0 ][ 0 ], the reference indices refIdxL0,refIdxL1 and the prediction list utilization flags predFlagL0[ 0 ][ 0 ]and predFlagL1[ 0 ][ 0 ] as inputs, and the motion vector differencesmMvdL0 and mMvdL1 as outputs. - The motion vector difference mMvdLX isadded to the merge motion vectors mvLX for X being 0 and 1 as follows:mvLX[ 0 ][ 0 ][ 0 ] += mMvdLX[ 0 ] (8-294) mvLX[ 0 ][ 0 ][ 1 ] +=mMvdLX[ 1 ] (8-295)

Referring to Table 1, gbiIdx may indicate a bi-prediction weight index,and gbiIdxCol may indicate a bi-prediction weight index for a temporalmerge candidate (eg, a temporal motion vector candidate in the mergecandidate list). In the procedure for deriving the motion vector of theluma component for the merge mode (Table of Contents 3 of 8.4.2.2), thegbiIdxCol may be derived as 0. That is, the weight index of the temporalmotion vector candidate may be derived as 0.

Alternatively, a weight index for a weighted average of temporal motionvector candidates may be derived based on weight index information on acollocated block. Here, the collocated block may be referred to as a colblock, a co-located block, or a co-located reference block, and the colblock may indicate a block at the same position as the current block onthe reference picture. For example, a procedure for deriving a motionvector of a luma component for the merge mode may be shown in Table 1below.

TABLE 2 8.4.2.2 Derivation process for luma motion vectors for mergemode This process is only invoked when merge_flag[ xCb ][ yPb ] is equalto 1, where ( xCb, yCb ) specify the top- left sample of the currentluma coding block relative to the top-left luma sample of the currentpicture. Inputs to this process are: - a luma location ( xCb, yCb ) ofthe top-left sample of the current luma coding block relative to thetop- left luma sample of the current picture, - a variable cbWidthspecifying the width of the current coding block in luma samples, - avariable cbHeight specifying the height of the current coding block inluma samples. Outputs of this process are: - the luma motion vectors in1/16 fractional-sample accuracy mvL0[ 0 ][ 0 ] and mvL1[ 0 ][ 0 ], - thereference indices refIdxL0 and refIdxL1, - the prediction listutilization flags predFlagL0[ 0 ][ 0 ] and predFlagL1[ 0 ][ 0 ], - thebi-prediction weight index gbiIdx. The bi-prediction weight index gbiIdxis set equal to 0. The motion vectors mvL0[ 0 ][ 0 ] and mvL1[ 0 ][ 0 ],the reference indices refIdxL0 and refIdxL1 and the predictionutilization flags predFlagL0[ 0 ][ 0 ] and predFlagL1[ 0 ][ 0 ] arederived by the following ordered steps:  1. The derivation process formerging candidates from neighbouring coding units as specified in clause8.4.2.3 is invoked with the luma coding block location ( xCb, yCb ), theluma coding block width cbWidth, and the luma coding block heightcbHeight as inputs, and the output being the availability flagsavailableFlagA₀, availableFlagA₁, availableFlagB₀, availableFlagB₁ andavailableFlagB₂, the reference indices refIdxLXA₀, refIdxLXA₁,refIdxLXB₀, refIdxLXB₁ and refIdxLXB₂, the prediction list utilizationflags predFlagLXA₀, predFlagLXA₁, predFlagLXB₀, predFlagLXB₁ andpredFlagLXB₂, and the motion vectors mvLXA₀, mvLXA₁, mvLXB₀, mvLXB₁ andmvLXB₂, with X being 0 or 1, and the bi-prediction weight indicesgbiIdxA₀, gbiIdxA₁, gbiIdxB₀, gbiIdxB₁, gbiIdxB₂.  2. The referenceindices, refIdxLXCol, with X being 0 or 1, and the bi-prediction weightindex gbiIdxCol for the temporal merging candidate Col are set equal to0.  3. The derivation process for temporal luma motion vector predictionas specified in in clause 8.4.2.11 is invoked with the luma location (xCb, yCb ), the luma coding block width cbWidth, the luma coding blockheight cbHeight and the variable refIdxL0Col as inputs, and the outputbeing the availability flag availableFlagL0Col and the temporal motionvector mvL0Col. The variables availableFlagCol, predFlagL0Col andpredFlagL1Col are derived as follows: availableFlagCol =availableFlagL0Col (8-283) predFlagL0Col = availableFlagL0Col (8-284)predFlagL1Col = 0 (8-285) gbiIdxCol = 0 (8-xxx)  4. When tile_group_typeis equal to B, the derivation process for temporal luma motion vectorprediction as specified in clause 8.4.2.11 is invoked with the lumalocation ( xCb, yCb ), the luma coding block width cbWidth, the lumacoding block height cbHeight and the variable refIdxL1Col as inputs, andthe output being the availability flag availableFlagL1Col and thetemporal motion vector mvL1Col. The variables availableFlagCol andpredFlagL1Col are derived as follows: availableFlagCol =availableFlagL0Col | | availableFlagL1Col (8-286) predFlagL1Col =availableFlagL1Col (8-287) gbiIdxCol = gbiIdxCol (x-xxx)  5. The mergingcandidate list, mergeCandList, is constructed as follows: i = 0 if(availableFlagA₁ ) mergeCandList[ i++ ] = A₁ if( availableFlagB₁ )mergeCandList[ i++ ] = B₁ if( availableFlagB₀ ) mergeCandList[ i++ ] =B₀ (8-288) if( availableFlagA₀ ) mergeCandList[ i++ ] = A₀ if(availableFlagB₂ ) mergeCandList[ i++ ] = B₂ if( availableFlagCol )mergeCandList[ i++ ] = Col  6. The variable numCurrMergeCand andnumOrigMergeCand are set equal to the number of merging candidates inthe mergeCandList.  7. When numCurrMergeCand is less than(MaxNumMergeCand − 1) and NumHmvpCand is greater than 0, the followingapplies: - The derivation process of history-based merging candidates asspecified in 8.4.2.6 is invoked with mergeCandList, and numCurrMergeCandas inputs, and modified mergeCandList and numCurrMergeCand as outputs. -numOrigMergeCand is set equal to numCurrMergeCand.  8. The derivationprocess for pairwise average merging candidates specified in clause8.4.2.4 is invoked with mergeCandList, the reference indices refIdxL0Nand refIdxL1N, the prediction list utilization flags predFlagL0N andpredFlagL1N, the motion vectors mvL0N and mvL1N of every candidate N inmergeCandList, numCurrMergeCand and numOrigMergeCand as inputs, and theoutput is assigned to mergeCandList, numCurrMergeCand, the referenceindices refIdxL0avgCand_(k) and refIdxL1avgCand_(k), the prediction listutilization flags predFlagL0avgCand_(k) and predFlagL1avgCand_(k) andthe motion vectors mvL0avgCand_(k) and mvL1avgCand_(k) of every newcandidate avgCand_(k) being added into mergeCandList. The bi-predictionweight index gbiIdx of every new candidate avgCand_(k) being added intomergeCandList is set equal to 0. The number of candidates being added,numAvgMergeCand, is set equal to ( numCurrMergeCand − numOrigMergeCand). When numAvgMergeCand is greater than 0, k ranges from 0 tonumAvgMergeCand − 1, inclusive.  9. The derivation process for zeromotion vector merging candidates specified in clause 8.4.2.5 is invokedwith the mergeCandList, the reference indices refIdxL0N and refIdxL1N,the prediction list utilization flags predFlagL0N and predFlagL1N, themotion vectors mvL0N and mvL1N of every candidate N in mergeCandList andnumCurrMergeCand as inputs, and the output is assigned to mergeCandList,numCurrMergeCand, the reference indices refIdxL0zeroCand_(m) andrefIdxL1zeroCand_(m), the prediction list utilization flagspredFlagL0zeroCand_(m) and predFlagL1zeroCand_(m) and the motion vectorsmvL0zeroCand_(m) and mvL1zeroCand_(m) of every new candidatezeroCand_(m) being added into mergeCandList. The bi-prediction weightindex gbiIdx of every new candidate zeroCand_(m) being added intomergeCandList is set equal to 0. The number of candidates being added,numZeroMergeCand, is set equal to ( numCurrMergeCand − numOrigMergeCand− numAvgMergeCand ). When numZeroMergeCand is greater than 0, m rangesfrom 0 to numZeroMergeCand − 1, inclusive. 10. The variablemergeIdxOffset is set equal to 0. 11. When mmvd_flag[ xCb ][ yCb ] isequal to 1, the variable mmvdCnt is set equal to 0 and tThe followingapplies until mmvdCnt is greater than ( merge_idx[ xCb ][ yCb ] +mergeIdxOffset ) or mmvdCnt is equal to MaxNumMergeCand: - Whencandidate mergeCandList[ mmvdCnt ] uses the current decoded picture asits reference picture, mergeIdxOffset is incremented by 1. - Thevariable mmvdCnt is incremented by 1. 12. The following assignments aremade with N being the candidate at position merge_idx[ xCb ][ yCb ] +mergeIdxOffset in the merging candidate list mergeCandList ( N =mergeCandList[ merge idx[ xCb ][ yCb ] + mergeIdxOffset ] ) and X beingreplaced by 0 or 1: refIdxLX = refIdxLXN (8-289) predFlagLX[ 0 ][ 0 ] =predFlagLXN (8-290) mvLX[ 0 ][ 0 ][ 0 ] = mvLXN[ 0 ] (8-291) mvLX[ 0 ][0 ][ 1 ] = mvLXN[ 1 ] (8-292) gbiIdx = gbiIdxN (8-293) 13. Whenmmvd_flag[ xCb ][ yCb ] is equal to 1, the following applies: - Thederivation process for merge motion vector difference as specified in8.4.2.7 is invoked with the luma location ( xCb, yCb ), the luma motionvectors mvL0[ 0 ][ 0 ], mvL1[ 0 ][ 0 ], the reference indices refIdxL0,refIdxL1 and the prediction list utilization flags predFlagL0[ 0 ][ 0 ]and predFlagL1[ 0 ][ 0 ] as inputs, and the motion vector differencesmMvdL0 and mMvdL1 as outputs. - The motion vector difference mMvdLX isadded to the merge motion vectors mvLX for X being 0 and 1 as follows:mvLX[ 0 ][ 0 ][ 0 ] += mMvdLX[ 0 ]  (8-294) mvLX[ 0 ][ 0 ][ 1 ] +=mMvdLX[ 1 ] (8-295)

Referring to Table 2, gbiIdx may indicate a bi-prediction weight index,and gbiIdxCol may indicate a bi-prediction weight index for a temporalmerge candidate (eg, a temporal motion vector candidate in the mergecandidate list). In the procedure of deriving the motion vector of theluma component for the merge mode, when the slice type or the tile grouptype is B (Table of Contents 4 of 8.4.2.2), the gbiIdxCol may be derivedas gbiIdxCol. That is, the weight index of the temporal motion vectorcandidate may be derived as the weight index of the col block.

Meanwhile, according to another embodiment of the present disclosure,when constructing a motion vector candidate for a merge mode in units ofsubblocks, a weight index for a weighted average of temporal motionvector candidates may be derived. Here, the merge mode in units ofsubblocks may be referred to as an affine merge mode (in units ofsubblocks). The temporal motion vector candidate may indicate asubblock-based temporal motion vector candidate, and may be referred toas an SbTMVP (or ATMVP) candidate. That is, when the inter-predictiontype is bi-prediction, the weight index information on the SbTMVPcandidate (or a subblock-based temporal motion vector candidate) in theaffine merge candidate list or the subblock merge candidate list may bederived.

For example, the weight index information on the weighted average ofsubblock-based temporal motion vector candidates may always be derivedas 0. Here, the weight index information of 0 may mean that the weightsof each reference direction (ie, the L0 prediction direction and the L1prediction direction in bi-prediction) are the same. For example, aprocedure for deriving a motion vector and a reference index in asubblock merge mode and a procedure for deriving a subblock-basedtemporal merge candidate may be as shown in Tables 3 and 4.

TABLE 3 8.4.4.2 Derivation process for motion vectors and referenceindices in subblock merge mode Inputs to this process are: - a lumalocation ( xCb, yCb ) of the top-left sample of the current luma codingblock relative to the top- left luma sample of the current picture, -two variables cbWidth and cbHeight specifying the width and the heightof the luma coding block. Outputs of this process are: - the number ofluma coding subblocks in horizontal direction numSbX and in verticaldirection numSbY, - the reference indices refIdxL0 and refIdxL1, - theprediction list utilization flag arrays predFlagL0[ xSbIdx ][ ySbIdx ]and predFlagL1[ xSbIdx ][ ySbIdx ], - the luma subblock motion vectorarrays in 1/16 fractional-sample accuracy mvL0[ xSbIdx ][ ySbIdx ] andmvL1[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0..numSbY− 1, - the chroma subblock motion vector arrays in 1/32fractional-sample accuracy mvCL0[ xSbIdx ][ ySbIdx ] and mvCL1[ xSbIdx][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0..numSbY − 1, - thebi-prediction weight index gbiIdx. The variables numSbX, numSbY and thesubblock merging candidate list, subblockMergeCandList are derived bythe following ordered steps: 1. When sps_sbtmvp_enabled_flag is equal to1, the following applies: - The derivation process for mergingcandidates from neighbouring coding units as specified in clause 8.4.2.3is invoked with the luma coding block location ( xCb, yCb ), the lumacoding block width cbWidth, the luma coding block height cbHeight andthe luma coding block width as inputs, and the output being theavailability flags availableFlagA₀, availableFlagA₁, availableFlagB₀,availableFlagB₁ and availableFlagB₂, the reference indices refIdxLXA₀,refIdxLXA₁, refIdxLXB₀, refIdxLXB₁ and refIdxLXB₂, the prediction listutilization flags predFlagLXA₀, predFlagLXA₁, predFlagLXB₀, predFlagLXB₁and predFlagLXB₂, and the motion vectors mvLXA₀, mvLXA₁, mvLXB₀, mvLXB₁and mvLXB₂, with X being 0 or 1. - The derivation process forsubblock-based temporal merging candidates as specified in clause8.4.4.3 is invoked with the luma location ( xCb, yCb ), the luma codingblock width cbWidth, the luma coding block height cbHeight, theavailability flags availableFlagA₀, availableFlagA₁, availableFlagB₀,availableFlagB₁, the reference indices refIdxLXA₀, refIdxLXA₁,refIdxLXB₀, refIdxLXB₁, the prediction list utilization flagspredFlagLXA₀, predFlagLXA₁, predFlagLXB₀, predFlagLXB₁ and the motionvectors mvLXA₀, mvLXA₁, mvLXB₀, mvLXB₁ as inputs and the output beingthe availability flag availableFlagSbCol, the bi-prediction weight indexgbiIdxSbCol, the number of luma coding subblocks in horizontal directionnumSbX and in vertical direction numSbY, the reference indicesrefIdxLXSbCol, the luma motion vectors mvLXSbCol[ xSbIdx ][ ySbIdx ] andthe prediction list utilization flags predFlagLXSbCol[ xSbIdx ][ ySbIdx] with xSbIdx = 0..numSbX − 1, ySbIdx = 0 .. numSbY − 1 and X being 0or 1. 2. When sps_affine_enabled_flag is equal to 1, the samplelocations ( xNbA₀, yNbA₀ ), ( xNbA₁, yNbA₁ ), ( xNbA₂, yNbA₂ ), ( xNbB₀,yNbB₀ ), ( xNbB₁, yNbB₁ ), ( xNbB₂, yNbB₂ ), ( xNbB₃, yNbB₃ ), and thevariables numSbX and numSbY are derived as follows: ( xA₀, yA₀ ) = ( xCb− 1, yCb + cbHeight ) (8-536) ( xA₁, yA₁ ) = ( xCb − 1, yCb + cbHeight −1 ) (8-537) ( xA₂, yA₂ ) = ( xCb − 1, yCb ) (8-538) ( xB₀, yB₀ ) = (xCb + cbWidth, yCb − 1 ) (8-539) ( xB₁, yB₁ ) = ( xCb + cbWidth − 1, yCb− 1 ) (8-540) ( xB₂, yB₂ ) = ( xCb − 1, yCb − 1 ) (8-541) ( xB₃, yB₃ ) =( xCb, yCb − 1 ) (8-542) numSbX = cbWidth >> 2 (8-543) numSbY =cbHeight >> 2 (8-544) 3. When sps_affine_enabled_flag is equal to 1, thevariable availableFlagA is set equal to FALSE and the following appliesfor ( xNbA_(k), yNbA_(k) ) from ( xNbA₀, yNbA₀ ) to ( xNbA₁, yNbA₁ ): -The availability derivation process for a block as specified in clause6.4.X [Ed. (BB): Neighbouring blocks availability checking process tbd]is invoked with the current luma location ( xCurr, yCurr ) set equal to( xCb, yCb ) and the neighbouring luma location ( xNbA_(k), yNbA_(k) )as inputs, and the output is assigned to the block availability flagavailableA_(k). - When availableA_(k) is equal to TRUE andMotionModelIdc[ xNbA_(k) ][ yNbA_(k) ] is greater than 0 andavailableFlagA is equal to FALSE, the following applies: - The variableavailableFlagA is set equal to TRUE, motionModelIdcA is set equal toMotionModelIdc[ xNbA_(k) ][ yNbA_(k) ], ( xNb, yNb ) is set equal to (CbPosX[ xNbA_(k) ][ yNbA_(k) ], CbPosY[ xNbA_(k) ][ yNbA_(k) ] ), nbW isset equal to CbWidth[ xNbA_(k) ][ yNbA_(k) ], nbH is set equal toCbHeight[ xNbA_(k) ][ yNbA_(k) ], numCpMv is set equal toMotionModelIdc[ xNbA_(k) ][ yNbA_(k) ] + 1, and gbiIdxA is set equal toGbiIdx[ xNbA_(k) ][ yNbA_(k) ]. - For X being replaced by either 0 or 1,the following applies:  -  When PredFlagLX[ xNbA_(k) ][ yNbA_(k) ] isequal to 1, the derivation process for luma affine  control point motionvectors from a neighbouring block as specified in clause 8.4.4.5 is invoked with the luma coding block location ( xCb, yCb ), the lumacoding block width  and height (cbWidth, cbHeight), the neighbouringluma coding block location  ( xNb, yNb ), the neighbouring luma codingblock width and height (nbW, nbH), and the  number of control pointmotion vectors numCpMv as input, the control point motion  vectorpredictor candidates cpMvLXA[ cpIdx ] with cpIdx = 0 .. numCpMv − 1 as output.  -  The following assignments are made:  predFlagLXA =PredFlagLX[ xNbA_(k) ][ yNbA_(k) ] (8-545)  refIdxLXA = RefIdxLX[ xNbAk][ yNbAk ] (8-546) 4. When sps_affine_enabled_flag is equal to 1, thevariable availableFlagB is set equal to FALSE and the following appliesfor ( xNbB_(k), yNbB_(k) ) from ( xNbB₀, yNbB₀ ) to ( xNbB₂, yNbB₂ ): -The availability derivation process for a block as specified in clause6.4.X [Ed. (BB): Neighbouring blocks availability checking process tbd]is invoked with the current luma location ( xCurr, yCurr ) set equal to( xCb, yCb ) and the neighbouring luma location ( xNbB_(k), yNbB_(k) )as inputs, and the output is assigned to the block availability flagavailableB_(k). - When availableB_(k) is equal to TRUE andMotionModelIdc[ xNbB_(k) ][ yNbB_(k) ] is greater than 0 andavailableFlagB is equal to FALSE, the following applies: - The variableavailableFlagB is set equal to TRUE, motionModelIdcB is set equal toMotionModelIdc[ xNbB_(k) ][ yNbB_(k) ], ( xNb, yNb ) is set equal to (CbPosX[ xNbAB ][ yNbB_(k) ], CbPosY[ xNbB_(k) ][ yNbB_(k) ] ), nbW isset equal to CbWidth[ xNbB_(k) ][ yNbB_(k) ], nbH is set equal toCbHeight[ xNbB_(k) ][ yNbB_(k) ], numCpMv is set equal toMotionModelIdc[ xNbB_(k) ][ yNbB_(k) ] + 1, and gbiIdxB is set equal toGbiIdx[ xNbB_(k) ][ yNbB_(k) ]. - For X being replaced by either 0 or 1,the following applies:  -  When PredFlagLX[ xNbB_(k) ][ yNbB_(k) ] isequal to TRUE, the derivation process for luma  affine control pointmotion vectors from a neighbouring block as specified in clause  8.4.4.5is invoked with the luma coding block location ( xCb, yCb ), the lumacoding  block width and height (cbWidth, cbHeight), the neighbouringluma coding block location  ( xNb, yNb ), the neighbouring luma codingblock width and height (nbW, nbH), and the  number of control pointmotion vectors numCpMv as input, the control point motion  vectorpredictor candidates cpMvLXB[ cpIdx ] with cpIdx = 0 .. numCpMv − 1 asoutput.  -  The following assignments are made:  predFlagLXB =PredFlagLX[ xNbB_(k) ][ yNbB_(k) ] (8-547)  refIdxLXB = RefIdxLX[xNbB_(k) ][ yNbB_(k) ] (8-548) 5. When sps_affine_enabled_flag is equalto 1, the derivation process for constructed affine control point motionvector merging candidates as specified in clause 8.4.4.6 is invoked withthe luma coding block location ( xCb, yCb ), the luma coding block widthand height (cbWidth, cbHeight), the availability flags availableA₀,availableA₁, availableA₂, availableB₀, availableB₁, availableB₂,availableB₃ as inputs, and the availability flags availableFlagConstK,the reference indices refIdxLXConstK, prediction list utilization flagspredFlagLXConstK, motion model indices motionModelIdcConstK andcpMvpLXConstK[ cpIdx ] with X being 0 or 1, K = 1..6, cpIdx = 0..2 asoutputs and gbiIdxConstK is set equal to 0 with K = 1..6.. 6. Theinitial subblock merging candidate list, subblockMergeCandList, isconstructed as follows: i = 0 if( availableFIagSbCol ) subblockMergeCandList[ i++ ] = SbCol if( availableFlagA && i <MaxNumSubblockMergeCand )  subblockMergeCandList[ i++ ] = A if(availableFIagB && i < MaxNumSubblockMergeCand )  subblockMergeCandList[i++ ] = B if( availableFlagConst1 && i < MaxNumSubblockMergeCand ) subblockMergeCandList[ i++ ] = Const1 (8-549) if( availableFlagConst2&& i < MaxNumSubblockMergeCand )  subblockMergeCandList[ i++ ] = Const2if( availableFlagConst3 && i < MaxNumSubblockMergeCand ) subblockMergeCandList[ i++ ] = Const3 if( availableFlagConst4 && i <MaxNumSubblockMergeCand )  subblockMergeCandList[ i++ ] = Const4 if(availableFlagConst5 && i < MaxNumSubblockMergeCand ) subblockMergeCandList[ i++ ] = Const5 if( availableFlagConst6 && i <MaxNumSubblockMergeCand )  subblockMergeCandList[ i++ ] = Const6 7. Thevariable numCurrMergeCand and numOrigMergeCand are set equal to thenumber of merging candidates in the subblockMergeCandList. 8. WhennumCurrMergeCand is less than MaxNumSubblockMergeCand, the following isrepeated until numCurrMrgeCand is equal to MaxNumSubblockMergeCand, withmvZero[0] and mvZero[1] both being equal to 0: - The reference indices,the prediction list utilization flags and the motion vectors ofzeroCand_(m) with m equal to ( numCurrMergeCand − numOrigMergeCand ) arederived as follows:  refIdxL0ZeroCand_(m) = 0 (8-550) predFlagL0ZeroCand_(m) = 1 (8-551)  cpMvL0ZeroCand_(m)[ 0 ] = mvZero(8-552)  cpMvL0ZeroCand_(m)[ 1 ] = mvZero (8-553)  cpMvL0ZeroCand_(m)[ 2] = mvZero (8-554)  refIdxL1ZeroCand_(m) = ( tile_group_type = = B ) ? 0: −1 (8-555)  predFlagL1ZeroCand_(m) = ( tile_group_type = = B ) ? 1 : 0(8-556)  cpMvL1ZeroCand_(m)[ 0 ] = mvZero (8-557)  cpMvL1ZeroCand_(m)[ 1] = mvZero (8-558)  cpMvL1ZeroCand_(m)[ 2 ] = mvZero (8-559) motionModelIdcZeroCand_(m) = 1 (8-560)  gbiIdxZeroCand_(m) = 0(8-561) - The candidate zeroCand_(m) with m equal to ( numCurrMergeCand− numOrigMergeCand ) is added at the end of subblockMergeCandList andnumCurrMergeCand is incremented by 1 as follows:  subblockMergeCandList[numCurrMergeCand++ ] = zeroCand_(m) (8-562) The variables refIdxL0,refIdxL1, predFlagL0[ xSbIdx ][ ySbIdx ], predFlagL1[ xSbIdx ][ ySbIdx], mvL0[ xSbIdx ][ ySbIdx ], mvL1[ xSbIdx ][ ySbIdx ], mvCL0[ xSbIdx ][ySbIdx ], and mvCL1[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1,ySbIdx = 0..numSbY − 1 are derived as follows: - IfsubblockMergeCandList[ merge_subblock_idx[ xCb ][ yCb ] ] is equal toSbCol, the bi-prediction weight index gbiIdx is set equal to 0 and thefollowing applies with X being 0 or 1:  refIdxLX = refIdxLXSbCol(8-563) - For xSbIdx = 0..numSbX − 1, ySbIdx = 0..numSbY − 1, thefollowing applies:  predFlagLX[ xSbIdx ][ ySbIdx ] = predFlagLXSbCol[xSbIdx ][ ySbIdx ] (8-564)  mvLX[ xSbIdx ][ ySbIdx ][ 0 ] = mvLXSbCol[xSbIdx ][ ySbIdx ][ 0 ] (8-565)  mvLX[ xSbIdx ][ ySbIdx ][ 1 ] =mvLXSbCol[ xSbIdx ][ ySbIdx ][ 1 ] (8-566) - When predFlagLX[ xSbIdx ][ySbIdx ], is equal to 1, the derivation process for chroma motionvectors in clause 8.4.2.13 is invoked with mvLX[ xSbIdx ][ ySbIdx ] andrefIdxLX as inputs, and the output being mvCLX[ xSbIdx ][ ySbIdx ]. -The following assignment is made for x = xCb ..xCb + cbWidth − 1 and y =yCb..yCb + cbHeight − 1:  MotionModelIdc[ x ][ y ] = 0 (8-567) -Otherwise (subblockMergeCandList[ merge_subblock_idx[ xCb ][ yCb ] ] isnot equal to SbCol), the following applies with X being 0 or 1: - Thefollowing assignments are made with N being the candidate at positionmerge_subblock_idx[ xCb ][ yCb ] in the subblock merging candidate listsubblockMenseCandList ( N = subblockMergeCandList[ merge subblock idx[xCb ][ yCb ] ] ):  refIdxLX = refIdxLXN (8-568)  predFlagLX[ 0][ 0 ] =predFlagLXN (8-569)  cpMvLX[ 0 ] = cpMvLXN[ 0 ] (8-570)  cpMvLX[ 1 ] =cpMvLXN[ 1 ] (8-571)  cpMvLX[ 2 ] = cpMvLXN[ 2 ] (8-572)  numCpMv =motionModelIdxN + 1 (8-573)  gbiIdx = gbiIdxN (8-574) - For xSbIdx =0..numSbX − 1, ySbIdx = 0..numSbY − 1, the following applies: predFlagLX[ xSbIdx ][ ySbIdx ] = predFlagLX[ 0 ][ 0 ] (8-575) - WhenpredFlagLX[ 0 ][ 0 ] is equal to 1, the derivation process for motionvector arrays from affine control point motion vectors as specified insubclause 8.4.4.9 is invoked with the luma coding block location ( xCb,yCb ), the luma coding block width cbWidth, the luma prediction blockheight cbHeight, the number of control point motion vectors numCpMv, thecontrol point motion vectors cpMvLX[ cpIdx ] with cpIdx being 0..2, andthe number of luma coding subblocks in horizontal direction numSbX andin vertical direction numSbY as inputs, the luma subblock motion vectorarray mvLX[ xSbIdx ][ ySbIdx ] and the chroma subblock motion vectorarray mvCLX[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx =0..numSbY − 1 as outputs. - The following assignment is made for x = xCb..xCb + cbWidth − 1 and y = yCb..yCb + cbHeight − 1:  MotionModelIdc[ x][ y ] = numCpMv − 1 (8-576)

TABLE 4 8.4.4.3 Derivation process for subblock-based temporal mergingcandidates Inputs to this process are: - a luma location ( xCb, yCb ) ofthe top-left sample of the current luma coding block relative to thetop-left luma sample of the current picture, - a variable cbWidthspecifying the width of the current coding block in luma samples, - avariable cbHeight specifying the height of the current coding block inluma samples. - the availability flags availableFlagA₀, availableFlagA₁,availableFlagB₀, and availableFlagB₁ of the neighbouring coding units, -the reference indices refIdxLXA₀, refIdxLXA₁, refIdxLXB₀, andrefIdxLXB₁of the neighbouring coding units, - the prediction list utilizationflags predFlagLXA₀, predFlagLXA₁, predFlagLXB₀, and predFlagLXB₁ of theneighbouring coding units, - the motion vectors in 1/16fractional-sample accuracy mvLXA₀, mvLXA₁, mvLXB₀, and mvLXB₁ of theneighbouring coding units. Outputs of this process are: - theavailability flag availableFlagSbCol, - the number of luma codingsubblocks in horizontal direction numSbX and in vertical directionnumSbY, - the reference indices refIdxL0SbCol and refIdxL1SbCol, - theluma motion vectors in 1/16 fractional-sample accuracy mvL0SbCol[ xSbIdx][ ySbIdx ] and mvL1SbCol[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX −1, ySbIdx = 0 .. numSbY − 1, - the prediction list utilization flagspredFlagL0SbCol[ xSbIdx ][ ySbIdx ] and predFlagL1SbCol[ xSbIdx ][ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0 .. numSbY − 1, - thebi-prediction weight index gbiIdxSbCol. The gbiIdxSbCol is set equal to0. ...

Referring to Tables 3 and 4 above, gbiIdx may indicate a bi-predictionweight index, gbiIdxSbCol may indicate a bi-prediction weight index fora subblock-based temporal merge candidate (eg, a temporal motion vectorcandidate in a subblock-based merge candidate list), and in theprocedure (8.4.4.3) for deriving the subblock-based temporal mergecandidate, the gbiIdxSbCol may be derived as 0. That is, the weightindex of the subblock-based temporal motion vector candidate may bederived as 0.

Alternatively, weight index information on a weighted average ofsubblock-based temporal motion vector candidates may be derived based onweight index information on a temporal center block. For example, thetemporal center block may indicate a subblock or sample positioned atthe center of the col block or the col block, and specifically, mayindicate a subblock positioned at the bottom-right of the four centralsubblocks or samples of the col block or a sample. For example, in thiscase, the procedure for deriving the motion vector and reference indexin the subblock merge mode, the procedure for deriving thesubblock-based temporal merge candidate, and the procedure for derivingthe base motion information for the subblock-based temporal merge may beshown in Table 5, Table 6, and Table 7.

TABLE 5 8.4.4.2 Derivation process for motion vectors and referenceindices in subblock merge mode Inputs to this process are: - a lumalocation ( xCb, yCb ) of the top-left sample of the current luma codingblock relative to the top- left luma sample of the current picture, -two variables cbWidth and cbHeight specifying the width and the heightof the luma coding block. Outputs of this process are: - the number ofluma coding subblocks in horizontal direction numSbX and in verticaldirection numSbY, - the reference indices refIdxL0 and refIdxL1, - theprediction list utilization flag arrays predFlagL0[ xSbIdx ][ ySbIdx ]and predFlagL1[ xSbIdx ][ ySbIdx ], - the luma subblock motion vectorarrays in 1/16 fractional-sample accuracy mvL0[ xSbIdx ][ ySbIdx ] andmvL1[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0..numSbY− 1, - the chroma subblock motion vector arrays in 1/32fractional-sample accuracy mvCL0[ xSbIdx ][ ySbIdx ] and mvCL1[ xSbIdx][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0..numSbY − 1, - thebi-prediction weight index gbiIdx. The variables numSbX, numSbY and thesubblock merging candidate list, subblockMergeCandList are derived bythe following ordered steps: 1. When sps_sbtmvp_enabled_flag is equal to1, the following applies: - The derivation process for mergingcandidates from neighbouring coding units as specified in clause 8.4.2.3is invoked with the luma coding block location ( xCb, yCb ), the lumacoding block width cbWidth, the luma coding block height cbHeight andthe luma coding block width as inputs, and the output being theavailability flags availableFlagA₀, availableFlagA₁, availableFlagB₀,availableFlagB₁ and availableFlagB₂, the reference indices refIdxLXA₀,refIdxLXA₁, refIdxLXB₀, refIdxLXB₁ and refIdxLXB₂, the prediction fistutilization flags predFlagLXA₀, predFlagLXA₁, predFlagLXB₀, predFlagLXB₁and predFlagLXB₂, and the motion vectors mvLXA₀, mvLXA₁, mvLXB₀, mvLXB₁and mvLXB₂, with X being 0 or 1.  - The derivation process forsubblock-based temporal merging candidates as specified in clause8.4.4.3 is invoked with the luma location ( xCb, yCb ), the luma codingblock width cbWidth, the luma coding block height cbHeight , theavailability flags availableFlagA₀, availableFlagA₁, availableFlagB₀,availableFlagB₁, the reference indices refIdxLXA₀, refIdxLXA₁,refIdxLXB₀, refIdxLXB₁, the prediction list utilization flagspredFlagLXA₀, predFlagLXA₁, predFlagLXB₀, predFlagLXB₁ and the motionvectors mvLXA₀, mvLXA₁, mvLXB₀, mvLXB₁ as inputs and the output beingthe availability flag availableFlagSbCol, the bi-prediction weight indexgbiIdxSbCol, the number of luma coding subblocks in horizontal directionnumSbX and in vertical direction numSbY, the reference indicesrefIdxLXSbCol, the luma motion vectors mvLXSbCol[ xSbIdx ][ ySbIdx ] andthe prediction list utilization flags predFlagLXSbCol[ xSbIdx ][ ySbIdx] with xSbIdx = 0..numSbX − 1, ySbIdx = 0 .. numSbY − 1 and X being 0or 1. 2.  When sps_affine_enabled_flag is equal to 1, the samplelocations ( xNbA₀, yNbA₀ ),  ( xNbA₁, yNbA₁ ), ( xNbA₂, yNbA₂ ), (xNbB₀, yNbB₀ ), ( xNbB₁, yNbB₁ ), ( xNbB₂, yNbB₂ ),  ( xNbB₃, yNbB₃ ),and the variables numSbX and numSbY are derived as follows:  ( xA₀, yA₀) = ( xCb − 1, yCb + cbHeight ) (8-536)  ( xA₁, yA₁ ) = ( xCb − 1, yCb +cbHeight − 1 ) (8-537)  ( xA₂, yA₂ ) = ( xCb − 1, yCb ) (8-538)  ( xB₀,yB₀ ) = ( xCb + cbWidth , yCb − 1 ) (8-539)  ( xB₁, yB₁ ) = ( xCb +cbWidth − 1, yCb − 1 ) (8-540)  ( xB₂, yB₂ ) = ( xCb − 1, yCb − 1 )(8-541)  ( xB₃, yB₃ ) = ( xCb, yCb − 1 ) (8-542)  numSbX = cbWidth >> 2(8-543)  numSbY = cbHeight >> 2 (8-544) 3.  When sps_affine_enabled_flagis equal to 1, the variable availableFlagA is set equal to FALSE and the following applies for ( xNbA_(k), yNbA_(k) ) from ( xNbA₀, yNbA₀ )to ( xNbA₁, yNbA₁ ):  - The availability derivation process for a blockas specified in clause 6.4.X [Ed. (BB): Neighbouring blocks availabilitychecking process tbd] is invoked with the current luma location ( xCurr,yCurr ) set equal to ( xCb, yCb ) and the neighbouring luma location (xNbA_(k), yNbA_(k) ) as inputs, and the output is assigned to the blockavailability flag availableA_(k). - When availableA_(k) is equal to TRUEand MotionModelIdc[ xNbA_(k) ][ yNbA_(k) ] is greater than 0 andavailableFlagA is equal to FALSE, the following applies: - The variableavailableFlagA is set equal to TRUE, motionModelIdcA is set equal toMotionModelIdc[ xNbA_(k) ][ yNbA_(k) ], ( xNb, yNb ) is set equal to (CbPosX[ xNbA_(k) ][ yNbA_(k) ], CbPosY[ xNbA_(k) ][ yNbA_(k) ] ), nbW isset equal to CbWidth[ xNbA_(k) ][ yNbA_(k) ], nbH is set equal toCbHeight[ xNbA_(k) ][ yNbA_(k) ], numCpMv is set equal toMotionModelIdc[ xNbA_(k) ][ yNbA_(k) ] + 1, and gbiIdxA is set equal toGbiIdx[ xNbA_(k) ][ yNbA_(k) ]. - For X being replaced by either 0 or 1,the following applies:  - When PredFlagLX[ xNbA_(k) ][ yNbA_(k) ] isequal to 1, the derivation process for luma affine  control point motionvectors from a neighbouring block as specified in clause 8.4.4.5 is invoked with the luma coding block location ( xCb, yCb ), the lumacoding block width  and height (cbWidth, cbHeight), the neighbouringluma coding block location  ( xNb, yNb ), the neighbouring luma codingblock width and height (nbW, nbH), and the  number of control pointmotion vectors numCpMv as input, the control point motion  vectorpredictor candidates cpMvLXA[ cpIdx ] with cpIdx = 0 .. numCpMv − 1 as output.  - The following assignments are made:  predFlagLXA =PredFlagLX[ xNbA_(k) ][ yNbA_(k) ] (8-545)  refIdxLXA = RefIdxLX[ xNbAk][ yNbAk ] (8-546) 4.  When sps_affine_enabled_flag is equal to 1, thevariable availableFlagB is set equal to FALSE and  the following appliesfor ( xNbB_(k), yNbB_(k) ) from ( xNbB₀, yNbB₀ ) to ( xNbB₂, yNbB₂ ):  -The availability derivation process for a block as specified in clause6.4.X [Ed. (BB): Neighbouring blocks availability checking process tbd]is invoked with the current luma location ( xCurr, yCurr ) set equal to( xCb, yCb ) and the neighbouring luma location ( xNbB_(k), yNbB_(k) )as inputs, and the output is assigned to the block availability flagavailableB_(k).  - When availableB_(k) is equal to TRUE andMotionModelIdc[ xNbB_(k) ][ yNbB_(k) ] is greater than 0 andavailableFlagB is equal to FALSE, the following applies: - The variableavailableFlagB is set equal to TRUE, motionModelIdcB is set equal toMotionModelIdc[ xNbB_(k) ][ yNbB_(k) ], ( xNb, yNb ) is set equal to (CbPosX[ xNbAB ][ yNbB_(k) ], CbPosY[ xNbB_(k) ][ yNbB_(k) ] ), nbW isset equal to CbWidth[ xNbB_(k) ][ yNbB_(k) ], nbH is set equal toCbHeight[ xNbB_(k) ][ yNbB_(k) ], numCpMv is set equal toMotionModelIdc[ xNbB_(k) ][ yNbB_(k) ] + 1, and gbiIdxB is set equal toGbiIdx[ xNbB_(k) ][ yNbB_(k) ]. - For X being replaced by either 0 or 1,the following applies:  - When PredFlagLX[ xNbB_(k) ][ yNbB_(k) ] isequal to TRUE, the derivation process for luma  affine control pointmotion vectors from a neighbouring block as specified in clause  8.4.4.5is invoked with the luma coding block location ( xCb, yCb ), the lumacoding  block width and height (cbWidth, cbHeight), the neighbouringluma coding block location  ( xNb, yNb ), the neighbouring luma codingblock width and height (nbW, nbH), and the  number of control pointmotion vectors numCpMv as input, the control point motion  vectorpredictor candidates cpMvLXB[ cpIdx ] with cpIdx = 0 .. numCpMv − 1 asoutput.  - The following assignments are made:  predFlagLXB =PredFlagLX[ xNbB_(k) ][ yNbB_(k) ] (8-547)  refIdxLXB = RefIdxLX[xNbB_(k) ][ yNbB_(k) ] (8-548) 5.  When sps_affine_enabled_flag is equalto 1, the derivation process for constructed affine control point motion vector merging candidates as specified in clause 8.4.4.6 isinvoked with the luma coding block  location ( xCb, yCb ), the lumacoding block width and height (cbWidth, cbHeight), the availability flags availableA₀, availableA₁, availableA₂, availableB₀, availableB₁,availableB₂, availableB₃ as  inputs, and the availability flagsavailableFlagConstK, the reference indices refIdxLXConstK,  predictionlist utilization flags predFlagLXConstK, motion model indicesmotionModelIdcConstK  and cpMvpLXConstK[ cpIdx ] with X being 0 or 1, K= 1..6, cpIdx = 0..2 as outputs and  gbiIdxConstK is set equal to 0 withK = 1..6.. 6.  The initial subblock merging candidate list,subblockMergeCandList, is constructed as follows:  i = 0  if(availableFlagSbCol )  subblockMergeCandList[ i++ ] = SbCol  if(availableFlagA && i < MaxNumSubblockMergeCand )  subblockMergeCandList[i++ ] = A  if( availableFlagB && i < MaxNumSubblockMergeCand ) subblockMergeCandList[ i++ ] = B  if( availableFlagConst1 && i <MaxNumSubblockMergeCand )  subblockMergeCandList[ i++ ] = Const1 (8-549) if( availableFlagConst2 && i < MaxNumSubblockMergeCand ) subblockMergeCandList[ i++ ] = Const2  if( availableFlagConst3 && i <MaxNumSubblockMergeCand )  subblockMergeCandList[ i++ ] = Const3  if(availableFlagConst4 && i < MaxNumSubblockMergeCand ) subblockMergeCandList[ i++ ] = Const4  if( availableFlagConst5 && i <MaxNumSubblockMergeCand )  subblockMergeCandList[ i++ ] = Const5  if(availableFlagConst6 && i < MaxNumSubblockMergeCand ) subblockMergeCandList[ i++ ] = Const6 7.  The variable numCurrMergeCandand numOrigMergeCand are set equal to the number of merging  candidatesin the subblockMergeCandList. 8.  When numCurrMergeCand is less thanMaxNumSubblockMergeCand, the following is repeated until numCurrMrgeCand is equal to MaxNumSubblockMergeCand, with mvZero[0] andmvZero[1] both  being equal to 0:  -  The reference indices, theprediction list utilization flags and the motion vectors of zeroCand_(m)with  m equal to ( numCurrMergeCand − numOrigMergeCand ) are derived asfollows:  refIdxL0ZeroCand_(m) = 0 (8-550)  predFlagL0ZeroCand_(m) = 1(8-551)  cpMvL0ZeroCand_(m)[ 0 ] = mvZero (8-552)  cpMvL0ZeroCand_(m)[ 1] = mvZero (8-553)  cpMvL0ZeroCand_(m)[ 2 ] = mvZero (8-554) refIdxL1ZeroCand_(m) = ( tile_group_type = = B ) ? 0 : −1 (8-555) predFlagL1ZeroCand_(m) = ( tile_group_type = = B ) ? 1 : 0 (8-556) cpMvL1ZeroCand_(m)[ 0 ] = mvZero (8-557)  cpMvL1ZeroCand_(m)[ 1 ] =mvZero (8-558)  cpMvL1ZeroCand_(m)[ 2 ] = mvZero (8-559) motionModelIdcZeroCand_(m) = 1 (8-560)  gbiIdxZeroCand_(m) = 0 (8-561) -  The candidate zeroCand_(m) with m equal to ( numCurrMergeCand −numOrigMergeCand ) is added at  the end of subblockMergeCandList andnumCurrMergeCand is incremented by 1 as follows:  subblockMergeCandList[numCurrMergeCand++ ] = zeroCand_(m) (8-562) The variables refIdxL0,refIdxL1, predFlagL0[ xSbIdx ][ ySbIdx ], predFlagL1[ xSbIdx ][ ySbIdx], mvL0[ xSbIdx ][ ySbIdx ], mvL1[ xSbIdx ][ ySbIdx ], mvCL0[ xSbIdx ][ySbIdx ], and mvCL1[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1,ySbIdx = 0..numSbY − 1 are derived as follows: -  IfsubblockMergeCandList[ merge_subblock_idx[ xCb ][ yCb ] ] is equal toSbCol, the bi-prediction  weight index gbiIdx is set equal to 0 and thefollowing applies with X being 0 or 1:  refIdxLX = refIdxLXSbCol (8-563) -  For xSbIdx = 0..numSbX − 1, ySbIdx = 0..numSbY − 1, the followingapplies:  predFlagLX[ xSbIdx ][ ySbIdx ] = predFlagLXSbCol[ xSbIdx ][ySbIdx ] (8-564)  mvLX[ xSbIdx ][ ySbIdx ][ 0 ] = mvLXSbCol[ xSbIdx ][ySbIdx ][ 0 ] (8-565)  mvLX[ xSbIdx ][ ySbIdx ][ 1 ] = mvLXSbCol[ xSbIdx][ ySbIdx ][ 1 ] (8-566)  - When predFlagLX[ xSbIdx ][ ySbIdx ], isequal to 1, the derivation process for chroma motion vectors in clause8.4.2.13 is invoked with mvLX[ xSbIdx ][ ySbIdx ] and refIdxLX asinputs, and the output being mvCLX[ xSbIdx ][ ySbIdx ]. -  The followingassignment is made for x = xCb ..xCb + cbWidth − 1 and  y = yCb..yCb +cbHeight − 1:  MotionModelIdc[ x ][ y ] = 0 (8-567) -  Otherwise(subblockMergeCandList[ merge_subblock_idx[ xCb ][ yCb ] ] is not equalto SbCol), the  following applies with X being 0 or 1: -  The followingassignments are made with N being the candidate at position merge_subblock_idx[ xCb ][ yCb ] in the subblock merging candidate listsubblockMergeCandList  ( N = subblockMergeCandList[ merge subblock idx[xCb ][ yCb ] ] ):  refIdxLX = refIdxLXN (8-568)  predFlagLX[ 0 ][ 0 ] =predFlagLXN (8-569)  cpMvLX[ 0 ] = cpMvLXN[ 0 ] (8-570)  cpMvLX[ 1 ] =cpMvLXN[ 1 ] (8-571)  cpMvLX[ 2 ] = cpMvLXN[ 2 ] (8-572)  numCpMv =motionModelIdxN + 1 (8-573)  gbiIdx = gbiIdxN (8-574) -  For xSbIdx =0..numSbX − 1, ySbIdx = 0..numSbY − 1, the following applies: predFlagLX[ xSbIdx ][ ySbIdx ] = predFlagLX[ 0 ][ 0 ] (8-575) -  WhenpredFlagLX[ 0 ][ 0 ] is equal to 1, the derivation process for motionvector arrays from affine  control point motion vectors as specified insubclause 8.4.4.9 is invoked with the luma coding block  location ( xCb,yCb ), the luma coding block width cbWidth, the luma prediction blockheight  cbHeight, the number of control point motion vectors numCpMv,the control point motion vectors  cpMvLX[ cpIdx ] with cpIdx being 0..2,and the number of luma coding subblocks in horizontal  direction numSbXand in vertical direction numSbY as inputs, the luma subblock motionvector array  mvLX[ xSbIdx ][ ySbIdx ] and the chroma subblock motionvector array mvCLX[ xSbIdx ][ ySbIdx ]  with xSbIdx = 0..numSbX − 1,ySbIdx = 0 .. numSbY − 1 as outputs. -  The following assignment is madefor x = xCb ..xCb + cbWidth − 1 and  y = yCb..yCb + cbHeight − 1: MotionModelIdc[ x ][ y ] = numCpMv − 1 (8-576)

TABLE 6 8.4.4.3 Derivation process for subblock-based temporal mergingcandidates Inputs to this process are: - a luma location ( xCb, yCb ) ofthe top-left sample of the current luma coding block relative to thetop-left luma sample of the current picture, - a variable cbWidthspecifying the width of the current coding block in luma samples, - avariable cbHeight specifying the height of the current coding block inluma samples. - the availability flags availableFlagA₀, availableFlagA₁,availableFlagB₀, and availableFlagB₁ of the neighbouring coding units, -the reference indices refIdxLXA₀, refIdxLXA₁, refIdxLXB₀, and refIdxLXB₁of the neighbouring coding units, - the prediction list utilizationflags predFlagLXA₀, predFlagLXA₁, predFlagLXB₀, and predFlagLXB₁ of theneighbouring coding units. - the motion vectors in 1/16fractional-sample accuracy mvLXA₀, mvLXA₁, mvLXB₀, and mvLXB₁ of theneighbouring coding units. Outputs of this process are: - theavailability flag availableFlagSbCol, - the number of luma codingsubblocks in horizontal direction numSbX and in vertical directionnumSbY, - the reference indices refIdxL0SbCol and refIdxL1SbCol, - theluma motion vectors in 1/16 fractional-sample accuracy mvL0SbCol[ xSbIdx][ ySbIdx ] and mvL1SbCol[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX −1, ySbIdx = 0 .. numSbY − 1, - the prediction list utilization flagspredFlagL0SbCol[ xSbIdx ][ ySbIdx ] and predFlagL1SbCol[ xSbIdx ][ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0 .. numSbY − 1, - thebi-prediction weight index gbiIdxSbCol. The availability flagavailableFlagSbCol is derived as follows. - If one or more of thefollowing conditions is true, availableFlagSbCol is set equal to 0. -tile_group_temporal_mvp_enable_flag is equal to 0. - sps_sbtmvp_flag isequal to 0. - cbWidth is less than 8. - cbHeight is less than 8. -Otherwise, the following ordered steps apply: 1. The location ( xCtb,yCtb ) of the top-left sample of the luma coding tree block thatcontains the current coding block and the location ( xCtr, yCtr ) of thebelow-right center sample of the current luma coding block are derivedas follows: xCtb = ( xCb >> CtuLog2Size ) << CtuLog2Size (8-577) yCtb =( yCb >> CtuLog2Size ) << CtuLog2Size (8-578) xCtr = xCb + ( cbWidth / 2) (8-579) yCtr = yCb + ( cbHeight / 2 ) (8-580) 2. The luma location (xColCtrCb, yColCtrCb ) is set equal to the top-left sample of thecollocated luma coding block covering the location given by ( xCtr, yCtr) inside ColPic relative to the top-left luma sample of the collocatedpicture specified by ColPic. 3. The derivation process forsubblock-based temporal merging base motion data as specified in clause8.4.4.4 is invoked with the location ( xCtb, yCtb ), the location (xColCtrCb, yColCtrCb ), the availability flags availableFlagA₀,availableFlagA₁, availableFlagB₀ and availableFlagB₁, and the predictionlist utilization flags predFlagLXA₀, predFlagLXA₁, predFlagLXB₀ andpredFlagLXB₁, and the reference indices refIdxLXA₀, refIdxLXA₁,refIdxLXB₀ and refIdxLXB₁, and the motion vectors mvLXA₀, mvLXA₁, mvLXB₀and mvLXB₁, with X being 0 and 1 as inputs and the motion vectorsctrMvLX, the prediction list utilization flags ctrPredFlagLX and thereference indices ctrRefIdxLX of the collocated block, with X being 0and 1, the bi-prediction weight index gbiIdxSbCol, and the temporalmotion vector tempMV as outputs. 4. The variable availableFlagSbCol isderived as follows: - If both ctrPredFlagL0 and ctrPredFlagL1 are equalto 0, availableFlagSbCol is set equal to 0. - Otherwise,availableFlagSbCol is set equal to 1. When availableFlagSbCol is equalto 1, the following applies: - The variables numSbX, numSbY, sbWidth,sbHeight and refIdxLXSbCol are derived as follows: numSbX = cbWidth >> 3(8-581) numSbY = cbHeight >> 3 (8-582) sbWidth = cbWidth / numSbX(8-583) sbHeight = cbHeight / numSbY (8-584) refIdxLXSbCol = 0 (8-585) -For xSbIdx = 0..numSbX − 1 and ySbIdx = 0 .. numSbY − 1, the motionvectors mvLXSbCol[ xSbIdx ][ ySbIdx ] and prediction list utilizationflags predFlagLXSbCol[ xSbIdx ][ ySbIdx ] are derived as follows: - Theluma location ( xSb, ySb ) specifying the top-left sample of the currentcoding subblock relative to the top-left luma sample of the currentpicture is derived as follows: xSb = xCb + xSbIdx * sbWidth (8-586) ySb= yCb + ySbIdx * sbHeight (8-587) - The location ( xColSb, yColSb ) ofthe collocated subblock inside ColPic is derived as follows. xColSb =Clip3( xCtb, Min( CurPicWidthInSamplesY − 1, xCtb + ( 1 << CtbLog2SizeY) + 3 ), (8-588) xSb + ( tempMv[0] >> 4 ) ) yColSb = Clip3( yCtb, Min(CurPicHeightInSamplesY − 1, yCtb + ( 1 << CtbLog2SizeY ) − 1 ), (8-589)ySb + ( tempMv[1] >> 4 ) ) - The variable currCb specifies the lumacoding block covering the current coding subblock inside the currentpicture. - The variable colCb specifies the luma coding block coveringthe modified location given by ( ( xColSb >> 3 ) << 3, ( yColSb >> 3 )<< 3 ) inside the ColPic. - The luma location ( xColCb, yColCb ) is setequal to the top-left sample of the collocated luma coding blockspecified by colCb relative to the top-left luma sample of thecollocated picture specified by ColPic. - The derivation process forcollocated motion vectors as specified in clause 8.4.2.12 is invokedwith currCb, colCb, ( xColCb, yColCb ), refIdxL0 set equal to 0 andsbFlag set equal to 1 as inputs and the output being assigned to themotion vector of the subblock mvL0SbCol[ xSbIdx ][ ySbIdx ] andavailableFlagL0SbCol. - The derivation process for collocated motionvectors as specified in clause 8.4.2.12 is invoked with currCb, colCb, (xColCb, yColCb ), refIdxL1 set equal to 0 and sbFlag set equal to 1 asinputs and the output being assigned to the motion vector of thesubblock mvL1SbCol[ xSbIdx ][ ySbIdx ] and availableFlagL1SbCol. - WhenavailableFlagL0SbCol and availableFlagL1SbCol are both equal to 0, thefollowing applies for X being 0 and 1: mvLXSbCol[ xSbIdx ][ ySbIdx ] =ctrMvLX (8-590) predFlagLXSbCol[ xSbIdx ][ ySbIdx ] = ctrPredFlagLX(8-591)

TABLE 7 8.4.4.4 Derivation process for subblock-based temporal mergingbase motion data Inputs to this process are: - the location ( xCtb, yCtb) of the top-left sample of the luma coding tree block that contains thecurrent coding block, - the location ( xColCtrCb, yColCtrCb ) of thetop-left sample of the collocated luma coding block that covers thebelow-right center sample. - the availability flags availableFlagA₀,availableFlagA₁, availableFlagB₀, and availableFlagB₁ of theneighbouring coding units, - the reference indices refIdxLXA₀,refIdxLXA₁, refIdxLXB₀, and refIdxLXB₁ of the neighbouring codingunits, - the prediction list utilization flags predFlagLXA₀,predFlagLXA₁, predFlagLXB₀, and predFlagLXB₁ of the neighbouring codingunits, - the motion vectors in 1/16 fractional-sample accuracy mvLXA₀,mvLXA₁, mvLXB₀, and mvLXB₁ of the neighbouring coding units. Outputs ofthis process are: - the motion vectors ctrMvL0 and ctrMvL1, - theprediction list utilization flags ctrPredFlagL0 and ctrPredFlagL1, - thereference indices ctrRefIdxL0 and ctrRefIdxL1, - the temporal motionvector tempMV, - the bi-prediction weight index gbiIdxSbCol. Thevariable tempMv is set as follows: tempMv[ 0 ] = 0 (8-592) tempMv[ 1 ] =0 (8-593) The variable currPic specifies the current picture. Thevariable availableFlagN is set equal to FALSE, and the followingapplies: - When availableFlagA₁ is equal to 1, the following applies: -availableFlagN is set equal to TRUE, - refIdxLXN is set equal torefIdxLXA₀ and mvLXN is set equal to mvLXA₀, for X being replaced by 0and 1. - When availableFlagN is equal to FALSE and availableFlagLB₁ isequal to 1, the following applies: - availableFlagN is set equal toTRUE, - refIdxLXN is set equal to refIdxLXB₀ and mvLXN is set equal tomvLXB₀, for X being replaced by 0 and 1. - When availableFlagN is equalto FALSE and availableFlagB₀ is equal to 1, the following applies: -availableFlagN is set equal to TRUE. - refIdxLXN is set equal torefIdxLXB₁ and mvLXN is set equal to mvLXB₁, for X being replaced by 0and 1. - When availableFlagN is equal to FALSE and availableFlagA₀isequal to 1, the following applies: - availableFlagN is set equal toTRUE. - refIdxLXN is set equal to refIdxLXA₁ and mvLXN is set equal tomvLXA₁, for X being replaced by 0 and 1. When availableFlagN is equal toTRUE, the following applies: - If all of the following conditions aretrue, tempMV is set equal to mvL1N: - predFlagL1N is equal to 1, -DiffPicOrderCnt(ColPic, RefPicList1[refIdxL1N]) is equal to 0, -DiffPicOrderCnt(aPic, currPic) is less than or equal to 0 for everypicture aPic in every reference picture list of the current tilegroup, - tile_group_type is equal to B, - collocated_from_l0_flag isequal to 0. - Otherwise if all of the following conditions are true,tempMV is set equal to mvL0N: - predFlagL0N is equal to 1, -DiffPicOrderCnt(ColPic, RefPicList0[refIdxL0N]) is equal to 0. Thelocation ( xColCb, yColCb ) of the collocated block inside ColPic isderived as follows. xColCb = Clip3( xCtb, Min( CurPicWidtInSamplesY − 1,xCtb + ( 1 << CtbLog2SizeY ) + 3 ),(8-59 4) xColCtrCb + ( tempMv[0] >> 4) ) yColCb = Clip3( yCtb, Min( CurPicHeightInSamplesY − 1, yCtb + ( 1 <<CtbLog2SizeY ) − 1 ), (8-5 95) yColCtrCb + ( tempMv[1] >> 4 ) ) Thearray colPredMode is set equal to the prediction mode array CuPredModeof the collocated picture specified by ColPic. The motion vectorsctrMvL0 and ctrMvL1, the prediction list utilization flags ctrPredFlagL0and ctrPredFlagL1, and the reference indices ctrRefIdxL0 and ctrRefIdxL1are derived as follows: - If colPredMode[xColCb][yColCb] is equal toMODE INTER, the following applies: - The variable currCb specifies theluma coding block covering ( xCtrCb ,yCtrCb ) inside the currentpicture. - The variable colCb specifies the luma coding block coveringthe modified location given by ( ( xColCb >> 3 ) << 3, ( yColCb >> 3 )<< 3 ) inside the ColPic. - The luma location ( xColCb, yColCb ) is setequal to the top-left sample of the collocated luma coding blockspecified by colCb relative to the top-left luma sample of thecollocated picture specified by ColPic. - The gbiIdxSbCol is set equalto gbiIdxcolCb. - The derivation process for temporal motion vectorprediction in subclause 8.4.2.12 is invoked with currCb, colCb, (xColCb,yColCb), centerRefIdxL0, and sbFlag set equal to 1 as inputs and theoutput being assigned to ctrMvL0 and ctrPredFlagL0. - The derivationprocess for temporal motion vector prediction in subclause 8.4.2.12 isinvoked with currCb, colCb, (xColCb, yColCb), centerRefIdxL1, and sbFlagset equal to 1 as inputs and the output being assigned to ctrMvL1 andctrPredFlagL1. - Otherwise, the following applies: ctrPredFlagL0 = 0(8-596) ctrPredFlagL1 = 0 (8-597)

Referring to Table 5, Table 6, and Table 7, gbiIdx may indicate abi-prediction weight index, and gbiIdxSbCol may indicate a bi-predictionweight index for a subblock-based temporal merge candidate (eg, atemporal motion vector candidate in a subblock-based merge candidatelist).<0} In the procedure (8.4.4.4) for deriving base motioninformation on subblock-based temporal merge, the gbiIdxSbCol may bederived as gbiIdxcolCb. That is, the weight index of the subblock-basedtemporal motion vector candidate may be derived as the weight index ofthe temporal center block. For example, the temporal center block mayindicate a subblock or sample positioned at the center of the col blockor the col block, and specifically, may indicate a subblock positionedat the bottom-right of the four central subblocks or samples of the colblock or a sample.

Alternatively, the weight index information on the weighted average ofthe subblock-based temporal motion vector candidates may be derivedbased on the weight index information in units of each subblock, and maybe derived based on the weight index information on the temporal centerblock when the subblock is not available. For example, the temporalcenter block may indicate a subblock or sample positioned at the centerof the col block or the col block, and specifically, may indicate asubblock positioned at the bottom-right of the four central subblocks orsamples of the col block or a sample. For example, in this case, theprocedure for deriving the motion vector and reference index in thesubblock merge mode, the procedure for deriving the subblock-basedtemporal merge candidate, and the procedure for deriving the base motioninformation for the subblock-based temporal merge may be shown in Table8, Table 9, and Table 10.

TABLE 8 8.4.4.2 Derivation process for motion vectors and referenceindices in subblock merge mode Inputs to this process are: - a lumalocation ( xCb, yCb ) of the top-left sample of the current luma codingblock relative to the top- left luma sample of the current picture, -two variables cbWidth and cbHeight specifying the width and the heightof the luma coding block. Outputs of this process are: - the number ofluma coding subblocks in horizontal direction numSbX and in verticaldirection numSbY, - the reference indices refIdxL0 and refIdxL1, - theprediction list utilization flag arrays predFlagL0[ xSbIdx ][ ySbIdx ]and predFlagL1[ xSbIdx ][ ySbIdx ], - the luma subblock motion vectorarrays in 1/16 fractional-sample accuracy mvL0[ xSbIdx ][ ySbIdx ] andmvL1[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0..numSbY− 1, - the chroma subblock motion vector arrays in 1/32fractional-sample accuracy mvCL0[ xSbIdx ][ ySbIdx ] and mvCL1[ xSbIdx][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0..numSbY − 1, - thebi-prediction weight index gbiIdx. The variables numSbX, numSbY and thesubblock merging candidate list, subblockMergeCandList are derived bythe following ordered steps: 1. When sps_sbtmvp_enabled_flag is equal to1, the following applies: -  The derivation process for mergingcandidates from neighbouring coding units as specified in  clause8.4.2.3 is invoked with the luma coding block location ( xCb, yCb ), theluma coding  block width cbWidth, the luma coding block height cbHeightand the luma coding block width  as inputs, and the output being theavailability flags availableFlagA₀, availableFlagA₁,  availableFlagB₀,availableFlagB₁ and availableFlagB₂, the reference indices refIdxLXA₀, refIdxLXA₁, refIdxLXB₀, refIdxLXB₁ and refIdxLXB₂, the prediction listutilization flags  predFlagLXA₀, predFlagLXA₁, predFlagLXB₀,predFlagLXB₁ and predFlagLXB₂, and the  motion vectors mvLXA₀, mvLXA₁,mvLXB₀, mvLXB₁ and mvLXB₂, with X being 0 or 1. - The derivation processfor subblock-based temporal merging candidates as specified in clause8.4.4.3 is invoked with the luma location ( xCb, yCb ), the luma codingblock width cbWidth, the luma coding block height cbHeight , theavailability flags availableFlagA₀, availableFlagA₁, availableFlagB₀,availableFlagB₁, the reference indices refIdxLXA₀, refIdxLXA₁,refIdxLXB₀, refIdxLXB₁, the prediction list utilization flagspredFlagLXA₀, predFlagLXA₁, predFlagLXB₀, predFlagLXB₁ and the motionvectors mvLXA₀, mvLXA₁, mvLXB₀, mvLXB₁ as inputs and the output beingthe availability flag availableFlagSbCol, the number of luma codingsubblocks in horizontal direction numSbX and in vertical directionnumSbY, the reference indices refIdxLXSbCol, the bi-prediction weightindex gbiIdxSbCol[ xSbIdx ][ ySbIdx ], the luma motion vectorsmvLXSbCol[ xSbIdx ][ ySbIdx ] and the prediction list utilization flagspredFlagLXSbCol[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx= 0 .. numSbY − 1 and X being 0 or 1. 2. When sps_affine_enabled_flag isequal to 1, the sample locations ( xNbA₀, yNbA₀ ), ( xNbA₁, yNbA₁ ), (xNbA₂, yNbA₂ ), ( xNbB₀, yNbB₀ ), ( xNbB₁, yNbB₁ ), ( xNbB₂, yNbB₂ ), (xNbB₃, yNbB₃ ), and the variables numSbX and numSbY are derived asfollows: ( xA₀, yA₀ ) = ( xCb − 1, yCb + cbHeight ) (8-536) ( xA₁, yA₁ )= ( xCb − 1, yCb + cbHeight − 1 ) (8-537) ( xA₂, yA₂ ) = ( xCb − 1, yCb) (8-538) ( xB₀, yB₀ ) = ( xCb + cbWidth , yCb − 1 ) (8-539) ( xB₁, yB₁) = ( xCb + cbWidth − 1, yCb − 1 ) (8-540) ( xB₂, yB₂ ) = ( xCb − 1, yCb− 1 ) (8-541) ( xB₃, yB₃ ) = ( xCb, yCb − 1 ) (8-542) numSbX =cbWidth >> 2 (8-543) numSbY = cbHeight >> 2 (8-544) 3. Whensps_affine_enabled_flag is equal to 1, the variable availableFlagA isset equal to FALSE and the following applies for ( xNbA_(k), yNbA_(k) )from ( xNbA₀, yNbA₀ ) to ( xNbA₁, yNbA₁ ): - The availability derivationprocess for a block as specified in clause 6.4.X [Ed. (BB): Neighbouringblocks availability checking process tbd] is invoked with the currentluma location ( xCurr, yCurr ) set equal to ( xCb, yCb ) and theneighbouring luma location ( xNbA_(k), yNbA_(k) ) as inputs, and theoutput is assigned to the block availability flag availableA_(k). - WhenavailableA_(k) is equal to TRUE and MotionModelIdc[ xNbA_(k) ][ yNbA_(k)] is greater than 0 and availableFlagA is equal to FALSE, the followingapplies: - The variable availableFlagA is set equal to TRUE,motionModelIdcA is set equal to MotionModelIdc[ xNbA_(k) ][ yNbA_(k) ],( xNb, yNb ) is set equal to ( CbPosX[ xNbA_(k) ][ yNbA_(k) ], CbPosY[xNbA_(k) ][ yNbA_(k) ] ), nbW is set equal to CbWidth[ xNbA_(k) ][yNbA_(k) ], nbH is set equal to CbHeight[ xNbA_(k) ][ yNbA_(k) ],numCpMv is set equal to MotionModelIdc[ xNbA_(k) ][ yNbA_(k) ] + 1, andgbiIdxA is set equal to GbiIdx[ xNbA_(k) ][ yNbA_(k) ]. - For X beingreplaced by either 0 or 1, the folowing applies: - When PredFlagLX[xNbA_(k) ][ yNbA_(k) ] is equal to 1, the derivation process for lumaaffine control point motion vectors from a neighbouring block asspecified in clause 8.4.4.5 is invoked with the luma coding blocklocation ( xCb, yCb ), the luma coding block width and height (cbWidth,cbHeight), the neighbouring luma coding block location ( xNb, yNb ), theneighbouring luma coding block width and height (nbW, nbH), and thenumber of control point motion vectors numCpMv as input, the controlpoint motion vector predictor candidates cpMvLXA[ cpIdx ] with cpIdx = 0.. numCpMv − 1 as output. - The following assignments are made:predFlagLXA = PredFlagLX[ xNbA_(k) ][ yNbA_(k) ] (8-545) refIdxLXA =RefIdxLX[ xNbAk ][ yNbAk ] (8-546) 4. When sps_affine_enabled_flag isequal to 1, the variable availableFlagB is set equal to FALSE and thefollowing applies for ( xNbB_(k), yNbB_(k) ) from ( xNbB₀, yNbB₀ ) to (xNbB₂, yNbB₂ ): - The availability derivation process for a block asspecified in clause 6.4.X [Ed. (BB): Neighbouring blocks availabilitychecking process tbd] is invoked with the current luma location ( xCurr,yCurr ) set equal to ( xCb, yCb ) and the neighbouring luma location (xNbB_(k), yNbB_(k) ) as inputs, and the output is assigned to the blockavailability flag availableB_(k). - When availableB_(k) is equal to TRUEand MotionModelIdc[ xNbB_(k) ][ yNbB_(k) ] is greater than 0 andavailableFlagB is equal to FALSE, the following applies: - The variableavailableFlagB is set equal to TRUE, motionModelIdcB is set equal toMotionModelIdc[ xNbB_(k) ][ yNbB_(k) ], ( xNb, yNb ) is set equal to (CbPosX[ xNbAB ][ yNbB_(k) ], CbPosY[ xNbB_(k) ][ yNbB_(k) ] ), nbW isset equal to CbWidth[ xNbB_(k) ][ yNbB_(k) ], nbH is set equal toCbHeight[ xNbB_(k) ][ yNbB_(k) ], numCpMv is set equal toMotionModelIdc[ xNbB_(k) ][ yNbB_(k) ] + 1, and gbiIdxB is set equal toGbiIdx[ xNbB_(k) ][ yNbB_(k) ]. - For X being replaced by either 0 or 1,the following applies: - When PredFlagLX[ xNbB_(k) ][ yNbB_(k) ] isequal to TRUE, the derivation process for luma affine control pointmotion vectors from a neighbouring block as specified in clause 8.4.4.5is invoked with the luma coding block location ( xCb, yCb ), the lumacoding block width and height (cbWidth, cbHeight), the neighbouring lumacoding block location ( xNb, yNb ), the neighbouring luma coding blockwidth and height (nbW, nbH), and the number of control point motionvectors numCpMv as input, the control point motion vector predictorcandidates cpMvLXB[ cpIdx ] with cpIdx = 0 .. numCpMv − 1 as output. -The following assignments are made: predFlagLXB = PredflagLX[ xNbB_(k)][ yNbB_(k) ] (8-547) refIdxLXB = RefIdxLX[ xNbB_(k) ][ yNbB_(k) ](8-548) 5. When sps_affine_enabled_flag is equal to 1, the derivationprocess for constructed affine control point motion vector mergingcandidates as specified in clause 8.4.4.6 is invoked with the lumacoding block location ( xCb, yCb ), the luma coding block width andheight (cbWidth, cbHeight), the availability flags availableA₀,availableA₁, availableA₂, availableB₀, availableB₁, availableB₂,availableB₃ as inputs, and the availability flags availableFlagConstK,the reference indices refIdxLXConstK, prediction list utilization flagspredFlagLXConstK, motion model indices motionModelIdcConstK andcpMvpLXConstK[ cpIdx ] with X being 0 or 1, K = 1..6, cpIdx = 0..2 asoutputs and gbiIdxConstK is set equal to 0 with K = 1..6.. 6. Theinitial subblock merging candidate list, subblockMergeCandList, isconstructed as follows: i = 0 if( availableFlagSbCol )subblockMergeCandList[ i++ ] = SbCol if( availableFlagA && i <MaxNumSubblockMergeCand ) subblockMergeCandList[ i++ ] = A if(availableFlagB && i < MaxNumSubblockMergeCand ) subblockMergeCandList[i++ ] = B if( availableFlagConst1 && i < MaxNumSubblockMergeCand )subblockMergeCandList[ i++ ] = Const1 (8-549) if( availableFlagConst2 &&i < MaxNumSubblockMergeCand ) subblockMergeCandList[ i++ ] = Const2 if(availableFlagConst3 && i < MaxNumSubblockMergeCand )subblockMergeCandList[ i++ ] = Const3 if( availableFlagConst4 && i <MaxNumSubblockMergeCand ) subblockMergeCandList[ i++ ] = Const4 if(availableFlagConst5 && i < MaxNumSubblockMergeCand )subblockMergeCandList[ i++ ] = Const5 if( availableFlagConst6 && i <MaxNumSubblockMergeCand ) subblockMergeCandList[ i++ ] = Const6 7. Thevariable numCurrMergeCand and numOrigMergeCand are set equal to thenumber of merging candidates in the subblockMergeCandList. 8. WhennumCurrMergeCand is less than MaxNumSubblockMergeCand, the following isrepeated until numCurrMrgeCand is equal to MaxNumSubblockMergeCand, withmvZero[0] and mvZero[1] both being equal to 0: - The reference indices,the prediction list utilization flags and the motion vectors ofzeroCand_(m) with m equal to ( numCurrMergeCand − numOrigMergeCand ) arederived as follows: refIdxL0ZeroCand_(m) = 0 (8-550)predFlagL0ZeroCand_(m) = 1 (8-551) cpMvL0ZeroCand_(m)[ 0 ] = mvZero(8-552) cpMvL0ZeroCand_(m)[ 1 ] = mvZero (8-553) cpMvL0ZeroCand_(m)[ 2 ]= mvZero (8-554) refIdxL1ZeroCand_(m) = ( tile_group_type = = B ) ? 0 :−1 (8-555) predFlagL1ZeroCand_(m) = ( tile_group_type = = B ) ? 1 : 0(8-556) cpMvL1ZeroCand_(m)[ 0 ] = mvZero (8-557) cpMvL1ZeroCand_(m)[ 1 ]= mvZero (8-558) cpMvL1ZeroCand_(m)[ 2 ] = mvZero (8-559)motionModelIdcZeroCand_(m) = 1 (8-560) gbiIdxZeroCand_(m) = 0 (8-561) -The candidate zeroCand_(m) with m equal to ( numCurrMergeCand −numOrigMergeCand ) is added at the end of subblockMergeCandList andnumCurrMergeCand is incremented by 1 as follows: subblockMergeCandList[numCurrMergeCand++ ] = zeroCand_(m) (8-562) The variables refIdxL0,refIdxL1, predFlagL0[ xSbIdx ][ ySbIdx ], predFlagL1[ xSbIdx ][ ySbIdx], mvL0[ xSbIdx ][ ySbIdx ], mvL1[ xSbIdx ][ ySbIdx ], mvCL0[ xSbIdx ][ySbIdx ], and mvCL1[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1,ySbIdx = 0..numSbY − 1 are derived as follows: - IfsubblockMergeCandList[ merge_subblock_idx[ xCb ][ yCb ] ] is equal toSbCol, the bi-prediction weight index gbiIdx is set equal to 0 and thefollowing applies with X being 0 or 1: refIdxLX = refIdxLXSbCol(8-563) - For xSbIdx = 0..numSbX − 1, ySbIdx = 0..numSbY − 1, thefollowing applies: predFlagLX[ xSbIdx ][ ySbIdx ] = predFlagLXSbCol[xSbIdx ][ ySbIdx ] (8-564) mvLX[ xSbIdx ][ ySbIdx ][ 0 ] = mvLXSbCol[xSbIdx ][ ySbIdx ][ 0 ] (8-565) mvLX[ xSbIdx ][ ySbIdx ][ 1 ] =mvLXSbCol[ xSbIdx ][ ySbIdx ][ 1 ] (8-566) - When predFlagLX[ xSbIdx ][ySbIdx ], is equal to 1, the derivation process for chroma motionvectors in clause 8.4.2.13 is invoked with mvLX[ xSbIdx ][ ySbIdx ] andrefIdxLX as inputs, and the output being mvCLX[ xSbIdx ][ ySbIdx ]. -The following assignment is made for x = xCb ..xCb + cbWidth − 1 and y =yCb..yCb + cbHeight − 1: MotionModelIdc[ x ][ y ] = 0 (8-567) -Otherwise (subblockMergeCandList[ merge_subblock_idx[ xCb ][ yCb ] ] isnot equal to SbCol), the following applies with X being 0 or 1: - Thefollowing assignments are made with N being the candidate at positionmerge_subblock_idx[ xCb ][ yCb ] in the subblock merging candidate listsubblockMergeCandList ( N = subblockMergeCandList[ merge_subblock_idx[xCb ][ yCb ] ] ): refIdxLX = refIdxLXN (8-568) predFlagLX[ 0 ][ 0 ] =predFlagLXN (8-569) cpMvLX[ 0 ] = cpMvLXN[ 0 ] (8-570) cpMvLX[ 1 ] =cpMvLXN[ 1 ] (8-571) cpMvLX[ 2 ] = cpMvLXN[ 2 ] (8-572) numCpMv =motionModelIdxN + 1 (8-573) gbiIdx = gbiIdxN (8-574) - For xSbIdx =0..numSbX − 1, ySbIdx = 0..numSbY − 1, the following applies:predFlagLX[ xSbIdx ][ ySbIdx ] = predFlagLX[ 0 ][ 0 ] (8-575) - WhenpredFlagLX[ 0 ][ 0 ] is equal to 1, the derivation process for motionvector arrays from affine control point motion vectors as specified insubclause 8.4.4.9 is invoked with the luma coding block location ( xCb,yCb ), the luma coding block width cbWidth, the luma prediction blockheight cbHeight, the number of control point motion vectors numCpMv, thecontrol point motion vectors cpMvLX[ cpIdx ] with cpIdx being 0..2, andthe number of luma coding subblocks in horizontal direction numSbX andin vertical direction numSbY as inputs, the luma subblock motion vectorarray mvLX[ xSbIdx ][ ySbIdx ] and the chroma subblock motion vectorarray mvCLX[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0.. numSbY − 1 as outputs. - The following assignment is made for x = xCb..xCb + cbWidth − 1 and y = yCb..yCb + cbHeight − 1: MotionModelIdc[ x][ y ] = numCpMv − 1 (8-576)

TABLE 9 8.4.4.3 Derivation process for subblock-based temporal mergingcandidates Inputs to this process are: - a luma location ( xCb, yCb ) ofthe top-left sample of the current luma coding block relative to thetop-left luma sample of the current picture, - a variable cbWidthspecifying the width of the current coding block in luma samples, - avariable cbHeight specifying the height of the current coding block inluma samples. - the availability flags availableFlagA₀, availableFlagA₁,availableFlagB₀, and availableFlagB₁ of the neighbouring coding units, -the reference indices refIdxLXA₀, refIdxLXA₁, refIdxLXB₀, and refIdxLXB₁of the neighbouring coding units, - the prediction list utilizationflags predFlagLXA₀, predFlagLXA₁, predFlagLXB₀, and predFlagLXB₁ of theneighbouring coding units, - the motion vectors in 1/16fractional-sample accuracy mvLXA₀, mvLXA₁, mvLXB₀, and mvLXB₁ of theneighbouring coding units. Outputs of this process are: - theavailability flag availableFlagSbCol, - the number of luma codingsubblocks in horizontal direction numSbX and in vertical directionnumSbY, - the reference indices refIdxL0SbCol and refIdxL1SbCol, - theluma motion vectors in 1/16 fractional-sample accuracy mvL0SbCol[ xSbIdx][ ySbIdx ] and mvL1SbCol[ xSbIdx ][ ySbIdx ] with xSbIdx = 0..numSbX −1, ySbIdx = 0 .. numSbY − 1, - the bi-prediction weight indexgbiIdxSbCol[ xSbIdx ][ ySbIdx ], the prediction list utilization flagspredFlagL0SbCol[ xSbIdx ][ ySbIdx ] and predFlagL1SbCol[ xSbIdx ][ySbIdx ] with xSbIdx = 0..numSbX − 1, ySbIdx = 0 .. numSbY − 1. Theavailability flag availableFlagSbCol is derived as follows. - If one ormore of the following conditions is true, availableFlagSbCol is setequal to 0. - tile group temporal mvp enable flag is equal to 0. -sps_sbtmvp_flag is equal to 0. - cbWidth is less than 8. - cbHeight isless than 8. - Otherwise, the following ordered steps apply: 1.  Thelocation ( xCtb, yCtb ) of the top-left sample of the luma coding treeblock that contains the current coding block and the location ( xCtr,yCtr ) of the below-right center sample of the current luma coding blockare derived as follows: xCtb = ( xCb >> CtuLog2Size ) << CtuLog2Size(8-577) yCtb = ( yCb >> CtuLog2Size ) << CtuLog2Size (8-578) xCtr =xCb + ( cbWidth / 2 ) (8-579) yCtr = yCb + ( cbHeight / 2 ) (8-580) 2. The luma location ( xColCtrCb, yColCtrCb ) is set equal to the top-leftsample of the collocated luma coding block covering the location givenby ( xCtr, yCtr ) inside ColPic relative to the top-left luma sample ofthe collocated picture specified by ColPic. 3.  The derivation processfor subblock-based temporal merging base motion data as specified inclause 8.4.4.4 is invoked with the location ( xCtb, yCtb ), the location( xColCtrCb, yColCtrCb ), the availability flags availableFlagA₀,availableFlagA₁, availableFlagB₀ and availableFlagB₁, and the predictionlist utilization flags predFlagLXA₀, predFlagLXA₁, predFlagLXB₀ andpredFlagLXB₁, and the reference indices refIdxLXA₀, refIdxLXA₁,refIdxLXB₀ and refIdxLXB₁, and the motion vectors mvLXA₀, mvLXA₁, mvLXB₀and mvLXB₁, with X being 0 and 1 as inputs and the motion vectorsctrMvLX, the prediction list utilization flags ctrPredFlagLX and thereference indices ctrRefIdxLX of the collocated block, with X being 0and 1, the bi-prediction weight index ctrgbiIdx, and the temporal motionvector tempMV as outputs. 4.  The variable availableFlagSbCol is derivedas follows:  - If both ctrPredFlagL0 and ctrPredFlagL1 are equal to 0,availableFlagSbCol is set equal to 0.  - Otherwise, availableFlagSbColis set equal to 1. When availableFlagSbCol is equal to 1, the followingapplies: - The variables numSbX, numSbY, sbWidth, sbHeight andrefIdxLXSbCol are derived as follows: numSbX = cbWidth >> 3 (8-581)numSbY = cbHeight >> 3 (8-582) sbWidth = cbWidth / numSbX (8-583)sbHeight = cbHeight / numSbY (8-584) refIdxLXSbCol = 0 (8-585) - ForxSbIdx = 0..numSbX − 1 and ySbIdx = 0 .. numSbY − 1, the motion vectorsmvLXSbCol[ xSbIdx ][ ySbIdx ] and prediction list utilization flagspredFlagLXSbCol[ xSbIdx ][ ySbIdx ] are derived as follows: -  The lumalocation ( xSb, ySb ) specifying the top-left sample of the currentcoding subblock relative  to the top-left luma sample of the currentpicture is derived as follows: xSb = xCb + xSbIdx * sbWidth (8-586) ySb= yCb + ySbIdx * sbHeight (8-587) -  The location ( xColSb, yColSb ) ofthe collocated subblock inside ColPic is derived as follows. xColSb =Clip3( xCtb, Min( CurPicWidthInSamplesY − 1, xCtb + ( 1 << CtbLog2SizeY) + 3 ),(8-58 8) xSb + ( tempMv[0] >> 4 ) ) yColSb = Clip3( yCtb, Min(CurPicHeightInSamplesY − 1, yCtb + ( 1 << CtbLog2SizeY ) − 1 ), (8-5 89)ySb + ( tempMv[1] >> 4 ) ) -  The variable currCb specifies the lumacoding block covering the current coding subblock inside the currentpicture. -  The variable colCb specifies the luma coding block coveringthe modified location given by ( ( xColSb >> 3 ) << 3, ( yColSb >> 3 )<< 3 ) inside the ColPic. -  The luma location ( xColCb, yColCb ) is setequal to the top-left sample of the collocated luma coding blockspecified by colCb relative to the top-left luma sample of thecollocated picture specified by ColPic. -  The gbiIdxSbCol[ xSbIdx ][ySbIdx ] is set equal to gbiIdxcolCb. -  The derivation process forcollocated motion vectors as specified in clause 8.4.2.12 is invokedwith currCb, colCb, ( xColCb, yColCb ), refIdxL0 set equal to 0 andsbFlag set equal to 1 as inputs and the output being assigned to themotion vector of the subblock mvL0SbCol[ xSbIdx ][ ySbIdx ] andavilableFlagL0SbCol. -  The derivation process for collocated motionvectors as specified in clause 8.4.2.12 is invoked with currCb, colCb, (xColCb, yColCb ), refidxL1 set equal to 0 and sbFlag set equal to 1 asinputs and the output being assigned to the motion vector of thesubblock mvL1SbCol[ xSbIdx ][ ySbIdx ] and availableFlagL1SbCol. -  WhenavailableFlagL0SbCol and availableFlagL1SbCol are both equal to 0, thefollowing applies for X being 0 and 1: mvLXSbCol[ xSbIdx ][ ySbIdx ] =ctrMvLX (8-590) predFlagLXSbCol[ xSbIdx ][ ySbIdx ] = ctrPredFlagLX(8-591) gbiIdxSbCol [ xSbIdx ][ ySbIdx ] = ctrgbiIdx (x-xxx)

TABLE 10 8.4.4.4 Derivation process for subblock-based temporal mergingbase motion data Inputs to this process are: - the location ( xCtb, yCtb) of the top-left sample of the luma coding tree block that contains thecurrent coding block, - the location ( xColCtrCb, yColCtrCb ) of thetop-left sample of the collocated luma coding block that covers thebelow-right center sample. - the availability flags availableFlagA₀,availableFlagA₁, availableFlagB₀, and availableFlagB₁ of theneighbouring coding units, - the reference indices refIdxLXA₀,refIdxLXA₁, refIdxLXB₀, and refIdxLXB₁ of the neighbouring codingunits, - the prediction list utilization flags predFlagLXA₀,predFlagLXA₁, predFlagLXB₀, and predFlagLXB₁ of the neighbouring codingunits, - the motion vectors in 1/16 fractional-sample accuracy mvLXA₀,mvLXA₁, mvLXB₀, and mvLXB₁ of the neighbouring coding units. Outputs ofthis process are: - the motion vectors ctrMvL0 and ctrMvL1, - theprediction list utilization flags ctrPredFlagL0 and ctrPredFlagL1, - thereference indices ctrRefIdxL0 and ctrRefIdxL1, - the temporal motionvector tempMV, - the bi-prediction weight index ctrgbiIdx. The variabletempMv is set as follows: tempMv[ 0 ] = 0 (8-592) tempMv[ 1 ] = 0(8-593) The variable currPic specifies the current picture. The variableavailableFlagN is set equal to FALSE, and the following applies: - WhenavailableFlagA₁ is equal to 1, the following applies:  - availableFlagNis set equal to TRUE, - refIdxLXN is set equal to refIdxLXA₀ and mvLXNis set equal to mvLXA₀, for X being replaced by 0 and 1. - WhenavailableFlagN is equal to FALSE and availableFlagLB₁ is equal to 1, thefollowing applies: - availableFlagN is set equal to TRUE, - refIdxLXN isset equal to refIdxLXB₀ and mvLXN is set equal to mvLXB₀, for X beingreplaced by 0 and 1. - When availableFlagN is equal to FALSE andavailableFlagB₀ is equal to 1, the following applies: - availableFlagNis set equal to TRUE. - refIdxLXN is set equal to refIdxLXB₁ and mvLXNis set equal to mvLXB₁, for X being replaced by 0 and 1. - WhenavailableFlagN is equal to FALSE and availableFlagA₀is equal to 1, thefollowing applies: - availableFlagN is set equal to TRUE. - refIdxLXN isset equal to refIdxLXA₁ and mvLXN is set equal to mvLXA₁, for X beingreplaced by 0 and 1. When availableFlagN is equal to TRUE, the followingapplies: - If all of the following conditions are true, tempMV is setequal to mvL1N: - predFlagL1N is equal to 1, - DiffPicOrderCnt(ColPic,RefPicList1[refIdxL1N]) is equal to 0, - DiffPicOrderCnt(aPic, currPic)is less than or equal to 0 for every picture aPic in every referencepicture list of the current tile group, - tile_group_type is equal toB, - collocated_from_l0_flag is equal to 0. - Otherwise if all of thefollowing conditions are true, tempMV is set equal to mvL0N: -predFlagL0N is equal to 1, - DiffPicOrderCnt(ColPic,RefPicList0[refIdxL0N]) is equal to 0. The location ( xColCb, yColCb )of the collocated block inside ColPic is derived as follows. xColCb =Clip3( xCtb, Min( CurPreWidthInSamplesY − 1, xCtb + ( 1 << CtbLog2SizeY) + 3 ),(8-59 4) xColCtrCb + ( tempMv[0] >> 4 ) ) yColCb = Clip3( yCtb,Min( CurPicHeightInSamplesY − 1, yCtb + ( 1 << CtbLog2SizeY ) − 1 ),(8-5 95) yColCtrCb + ( tempMv[1] >> 4 ) ) The array colPredMode is setequal to the prediction mode array CuPredMode of the collocated picturespecified by ColPic. The motion vectors ctrMvL0 and ctrMvL1, theprediction list utilization flags ctrPredFlagL0 and ctrPredFlagL1, andthe reference indices ctrRefIdxL0 and ctrRefIdxL1 are derived asfollows: - If colPredMode[xColCb][yColCb] is equal to MODE_INTER, thefollowing applies: - The variable currCb specifies the luma coding blockcovering ( xCtrCb ,yCtrCb ) inside the current picture. - The variablecolCb specifies the luma coding block covering the modified locationgiven by ( ( xColCb >> 3 ) << 3, ( yColCb >> 3 ) << 3 ) inside theColPic. - The luma location ( xColCb, yColCb ) is set equal to thetop-left sample of the collocated luma coding block specified by colCbrelative to the top-left luma sample of the collocated picture specifiedby ColPic. - The gbiIdxSbCol is set equal to ctrgbiIdx. - The derivationprocess for temporal motion vector prediction in subclause 8.4.2.12 isinvoked with currCb, colCb, (xColCb, yColCb), centerRefIdxL0, and sbFlagset equal to 1 as inputs and the output being assigned to ctrMvL0 andctrPredFlagL0. - The derivation process for temporal motion vectorprediction in subclause 8.4.2.12 is invoked with currCb, colCb, (xColCb,yColCb), centerRefIdxL1, and sbFlag set equal to 1 as inputs and theoutput being assigned to ctrMvL1 and ctrPredFlagL1. - Otherwise, thefollowing applies: ctrPredFlagL0 = 0  (8-596) ctrPredFlagL1 = 0  (8-597)

Referring to Table 8, Table 9, and Table 10, gbiIdx may indicate abi-prediction weight index, and gbiIdxSbCol may indicate a bi-predictionweight index for a subblock-based temporal merge candidate (eg, atemporal motion vector candidate in a subblock-based merge candidatelist). In the procedure (8.4.4.3) for deriving base motion informationon subblock-based temporal merge, the gbiIdxSbCol may be derived asgbiIdxcolCb. Alternatively, in the procedure (8.4.4.3) of deriving basemotion information on subblock-based temporal merge according to acondition (eg, when availableFlagL0SbCol and availableFlagL1SbCol areboth 0), the gbiIdxSbCol may be derived as ctrgbiIdx, and in theprocedure (8.4.4.4) for deriving base motion information onsubblock-based temporal merge, the ctrgbiIdx may be derived asgbiIdxSbCol. That is, the weight index of the subblock-based temporalmotion vector candidate may be derived as a weight index in units ofeach subblock, or when the subblock is not available, may be derived asthe weight index of the temporal center block. For example, the temporalcenter block may indicate a subblock or sample positioned at the centerof the col block or the col block, and specifically, may indicate asubblock positioned at the bottom-right of the four central subblocks orsamples of the col block or a sample.

Meanwhile, according to another embodiment of the present disclosure,when constructing a motion vector candidate for a merge mode, weightindex information on a pair-wise candidate may be derived. For example,a pair-wise candidate may be included in the merge candidate list, andweight index information on a weighted average of the pair-wisecandidate may be derived. The pair-wise candidate may be derived basedon other merge candidates in the merge candidate list, and when thepair-wise candidate uses bi-prediction, a weight index for a weightedaverage may be derived. That is, when the inter-prediction type isbi-prediction, weight index information on pair-wise candidates in themerge candidate list may be derived.

The pair-wise candidate may be derived based on other two mergecandidates (eg, cand0 and cand1) among the candidates included in themerge candidate list.

For example, the weight index information on the pair-wise candidate maybe derived based on the weight index information on any one of the twomerge candidates (eg, the merge candidate cand0 or the merge candidatecalla). For example, the weight index information on the pair-wisecandidate may be derived based on the weight index information on acandidate using bi-prediction among the two merge candidates.

Alternatively, when the weight index information on each of the othertwo merge candidates is the same as the first weight index information,the weight index information on the pair-wise candidate may be derivedbased on the first weight index information. Meanwhile, when the weightindex information on each of the other two merge candidates is not thesame, the weight index information on the pair-wise candidate may bederived based on the default weight index information. The defaultweight index information may correspond to weight index information onassignment of the same weight to each of the L0 prediction samples andthe L1 prediction samples.

Alternatively, when the weight index information on each of the othertwo merge candidates is the same as the first weight index information,the weight index information on the pair-wise candidate may be derivedbased on the first weight index information. Meanwhile, when the weightindex information on each of the other two merge candidates is not thesame, the weight index information on the pair-wise candidate includesthe default weight index information among the weight index informationon each of the other two candidates. The default weight indexinformation may correspond to weight index information on assignment ofthe same weight to each of the L0 prediction samples and the L1prediction samples.

Meanwhile, according to another embodiment of the present disclosure,when constructing a motion vector candidate for a merge mode in units ofsubblocks, weight index information on a weighted average of temporalmotion vector candidates may be derived. Here, the merge mode in unitsof subblocks may be referred to as an affine merge mode (in units ofsubblocks). The temporal motion vector candidate may indicate asubblock-based temporal motion vector candidate, and may be referred toas an SbTMVP (or ATMVP) candidate. The weight index information on theSbTMVP candidate may be derived based on the weight index information onthe left neighboring block of the current block. That is, when thecandidate derived by SbTMVP uses bi-prediction, the weight index of theleft neighboring block of the current block may be derived as the weightindex for the subblock-based merge mode.

For example, since the SbTMVP candidate may derive a col block based onthe spatially adjacent left block (or left neighboring block) of thecurrent block, the weight index of the left neighboring block may beconsidered reliable. Accordingly, the weight index for the SbTMVPcandidate may be derived as the weight index of the left neighboringblock.

Meanwhile, according to another embodiment of the present disclosure,when constructing a motion vector candidate for an affine merge mode, inthe case where an affine merge candidate uses bi-prediction, weightindex information on a weighted average may be derived. That is, whenthe inter-prediction type is bi-prediction, weight index information ona candidate in the affine merge candidate list or the subblock mergecandidate list may be derived.

For example, among affine merge candidates, a constructed affine mergecandidate may derive CP0, CP1, CP2, or CP3 candidates based on aspatially adjacent block of the current block or a temporally adjacentblock to indicate a candidate for deriving the MVF as the affine model.For example, CP0 may indicate a control point located at the upper-leftsample position of the current block, CP1 may indicate a control pointlocated at the upper-right sample position of the current block, and CP2may indicate the bottom-left sample position of the current block. Also,CP3 may indicate a control point located at the bottom-right sampleposition of the current block.

For example, the constructed affine merge candidate among the affinemerge candidates may be generated as a combination of motion vectors foreach control point of the current block as follows. The affine mergecandidate may include at least one of motion vectors for each of controlpoint 0 (CP0) positioned on the top-left of the current block, controlpoint 1 (CP1) positioned on the right side of the current block, controlpoint 2 (CP2) positioned on the bottom-left of the current block, andeach of control point 3 (CP3) positioned at the bottom-right of thecurrent block.

For example, among the affine merge candidates, the constructed affinemerge candidates may be generated based on a combination of each controlpoint like {CP0, CP1, CP2}, {CP0, CP1, CP3}, {CP0, CP2, CP3}, {CP1, CP2,CP3}, {CP0, CP1}, and {CP0, CP2} may be generated based on a combinationof each control point of the current block. For example, the affinemerge candidates may include at least one of {CPMV0, CPMV1, CPMV2},{CPMV0, CPMV1, CPMV3}, {CPMV0, CPMV2, CPMV3}, {CPMV1, CPMV2, CPMV3},{CPMV0, CPMV1}, and {CPMV0, CPMV2}. CPMV0, CPMV1, CPMV2, and CPMV3 maycorrespond to motion vectors for CP0, CP1, CP2, and CP3, respectively.

In one embodiment, when the affine merge candidate is generated based onany one of {CP0, CP1, CP2}, {CP0, CP1, CP3}, {CP0, CP2, CP3}, {CP0,CP1}, and {CP0, CP2}, weight index information on the affine mergecandidate may be derived based on weight index information on a specificblock among neighboring blocks of the CP0. That is, when the affinemerge candidate includes a CPMV0 for control point 0 (CP0) positioned atthe top-left of the current block, the weight index information on theaffine merge candidate may be derived based on 0th weight indexinformation on the CP0. Meanwhile, when the affine merge candidate isgenerated based on {CP1, CP2, CP3}, the weight index information on theaffine merge candidate may be derived based on weight index informationof a specific block among neighboring blocks of CP1. That is, when theaffine merge candidate is generated based on {CP1, CP2, CP3}, the weightindex information on the affine merge candidate may be derived based onfirst weight index information on control point 1 (CP1) positioned onthe top-right of the current block.

According to the above method, the weight index information on theaffine merge candidate may be derived based on weight index informationof a block used for deriving {CPMV0, CPMV1, CPMV2}, {CPMV0, CPMV1,CPMV3}, {CPMV0, CPMV2, CPMV3}, {CPMV1, CPMV2, CPMV3}, {CPMV0, CPMV1} and{CPMV0, CPMV2}, respectively.

According to another embodiment of deriving the weight index informationon the affine merge candidate, when the weight index information for CP0positioned at the top-left of the current block and the weight indexinformation on CP1 positioned at the top-right of the current block arethe same, the weight index information on the affine merge candidate maybe derived based on weight index information on a specific block amongneighboring blocks of the CP0. Meanwhile, when the weight indexinformation on the CP0 positioned at the top-left of the current blockand the weight index information on the CP1 positioned at the top-rightof the current block are not the same, the weight index information onthe affine merge candidate may be derived based on default weight indexinformation. The default weight index information may correspond toweight index information on giving the same weight to each of the L0prediction samples and the L1 prediction samples.

According to another embodiment of deriving the weight index informationon the affine merge candidate, the weight index information on theaffine merge candidate may be derived as a weight index of a candidatehaving a high frequency of occurrence among the weight indexes of eachcandidate. For example, a weight index of a candidate block determinedas a motion vector in CP0 among CP0 candidate blocks, a weight index ofa candidate block determined as a motion vector in CP1 among CP1candidate blocks, a weight index of a candidate block determined as amotion vector in CP2 among CP2 candidate blocks, and/or the mostoverlapping weight index among the weight indexes of the candidateblocks determined as the motion vector in CP3 among the CP3 candidateblocks may be derived as the weight index of the affine merge candidate.

For example, CP0 and CP1 may be used as the control point, CP0, CP1, andCP2 may be used, and CP3 may not be used. However, for example, when aCP3 candidate of an affine block (a block coded in the affine predictionmode) is to be used, the method of deriving a weight index in thetemporal candidate block described in the above-described embodimentsmay be used.

FIGS. 14 and 15 are diagrams schematically illustrating an example of avideo/image encoding method and related components according toembodiment(s) of the present disclosure.

The method disclosed in FIG. 14 may be performed by the encodingapparatus disclosed in FIG. 2 or 15. Specifically, for example, S1400 toS1420 of FIG. 14 may be performed by the prediction unit 220 of theencoding apparatus 200 of FIG. 15, S1430 of FIG. 14 may be performed bythe residual processor 230 of the encoding apparatus 200 of FIG. 15, andS1440 of FIG. 14 may be performed by the entropy encoder 240 of theencoding apparatus 200 of FIG. 15. In addition, although not illustratedin FIG. 14, in FIG. 15, prediction samples or prediction-relatedinformation may be derived by the prediction unit 220 of the encodingapparatus 200, residual information may be derived from original samplesor prediction samples by the residual processor 230 of the encodingapparatus 200, and a bitstream may be generated from residualinformation or prediction-related information by the entropy encoder 240of the encoding apparatus 200. The method disclosed in FIG. 14 mayinclude the embodiments described above in the present disclosure.

Referring to FIG. 14, the encoding apparatus may determine theinter-prediction mode of the current block and generate inter-predictionmode information indicating the inter-prediction mode (S1400). Forexample, the encoding apparatus may determine a merge mode, an affine(merge) mode, or a subblock merge mode as an inter-prediction mode to beapplied to the current block, and may generate inter-prediction modeinformation indicating the determined merge mode, affine (merge) mode,or subblock merge mode. In addition, the encoding apparatus may generateinter-prediction type information indicating the inter-prediction typeof the current block as the bi-prediction. For example, theinter-prediction type of the current block may be determined asbi-prediction among L0 prediction, L1 prediction, or bi-prediction, andinter-prediction type information indicating this may be generated.Here, L0 prediction may indicate prediction based on reference picturelist 0, L1 prediction may indicate prediction based on reference picturelist 1, and bi-prediction may indicate prediction based on referencepicture list 0 and reference picture list 1. For example, the encodingapparatus may generate inter-prediction type information based on theinter-prediction type. For example, the inter-prediction typeinformation may include an inter_pred_idc syntax element.

The encoding apparatus may generate a merge candidate list of thecurrent block based on the inter-prediction mode (S1410). For example,the encoding apparatus may generate a merge candidate list according tothe determined inter-prediction mode. Here, when the determinedinter-prediction mode is an affine merge mode or a subblock merge mode,the merge candidate list may be referred to as an affine merge candidatelist or a subblock merge candidate list, but may also be simply referredto as a merge candidate list.

For example, candidates may be inserted into the merge candidate listuntil the number of candidates in the merge candidate list becomes themaximum number of candidates. Here, the candidate may indicate acandidate or a candidate block for deriving motion information (ormotion vector) of the current block. For example, the candidate blockmay be derived through a search for neighboring blocks of the currentblock. For example, a neighboring block may include a spatialneighboring block and/or a temporal neighboring block of the currentblock, a spatial neighboring block may be preferentially searched toderive a (spatial merge) candidate, and then a temporal neighboringblock may be searched to derive a (temporal merge) candidate, and thederived candidates may be inserted into the merge candidate list. Forexample, when the number of candidates in the merge candidate list isless than the maximum number of candidates in the merge candidate listeven after the candidates are inserted, additional candidates may beinserted. For example, additional candidates include at least one ofhistory based merge candidate(s), pair-wise average merge candidate(s),ATMVP, and combined bi-predictive merge candidates (when the slice/tilegroup type of the current slice/tile group is type B) and/or a zerovector merge candidate.

Alternatively, for example, candidates may be inserted into the affinemerge candidate list until the number of candidates in the affine mergecandidate list becomes the maximum number of candidates. Here, thecandidate may include a control point motion vector (CPMV) of thecurrent block. Alternatively, the candidate may indicate a candidate ora candidate block for deriving the CPMV. The CPMV may indicate a motionvector at a control point (CP) of the current block. For example, thenumber of CPs may be 2, 3, or 4, the CP may be positioned at at least apart of top-left (or top-left corner), top-right (or top-right corner),bottom-left (or bottom-left corner), or bottom-right (or bottom-rightcorner) of the current block, and only one CP may exist at eachposition.

For example, a candidate may be derived through a search for aneighboring block (or a neighboring block of a CP of the current block)of the current block. For example, the affine merge candidate list mayinclude at least one of an inherited affine merge candidate, aconstructed affine merge candidate, and a zero motion vector candidate.For example, in the affine merge candidate list, the inherited affinemerge candidate may be inserted first, and then the constructed affinemerge candidate may be inserted. In addition, even though affine mergecandidates constructed in the affine merge candidate list are inserted,when the number of candidates in the affine merge candidate list issmaller than the maximum number of candidates, the remainder may befilled with zero motion vector candidates. Here, the zero motion vectorcandidate may be referred to as a zero vector. For example, the affinemerge candidate list may be a list according to an affine merge mode inwhich a motion vector is derived in units of samples, or may be a listaccording to an affine merge mode in which a motion vector is derived inunits of subblocks. In this case, the affine merge candidate list may bereferred to as a subblock merge candidate list, and the subblock mergecandidate list may also include candidates (or SbTMVP candidates)derived from SbTMVP. For example, when the SbTMVP candidate is includedin the subblock merge candidate list, it may be positioned before theinherited affine merge candidate and the constructed affine mergecandidate in the subblock merge candidate list.

The encoding apparatus may generate selection information indicating oneof candidates included in the merge candidate list (S1420). For example,the merge candidate list may include at least some of a spatial mergecandidate, a temporal merge candidate, a pair-wise candidate, or a zerovector candidate, and one of these candidates may be selected forinter-prediction of the current block. Alternatively, for example, thesubblock merge candidate list may include at least some of an inheritedaffine merge candidate, a constructed affine merge candidate, an SbTMVPcandidate, or a zero vector candidate, and one candidate of thesecandidates for inter-prediction of the current block may be selected.

For example, the selection information may include index informationindicating a selected candidate in the merge candidate list. Forexample, the selection information may be referred to as merge indexinformation or subblock merge index information.

The encoding apparatus may generate residual information based onresidual samples of the current block (S1430). For example, the encodingapparatus may derive residual samples based on the prediction samplesand original samples. For example, the encoding apparatus may generateresidual information indicating quantized transform coefficients of theresidual sample. The residual information may be generated throughvarious encoding methods such as exponential Golomb, CAVLC, CABAC, andthe like.

The encoding apparatus may encode image information includinginter-prediction mode information, selection information, and residualinformation (S1440). For example, the image information may be referredto as video information. The image information may include variousinformation according to the above-described embodiment(s) of thepresent disclosure. For example, the image information may include atleast a part of prediction-related information or residual-relatedinformation. For example, the prediction-related information may includeat least a part of the inter-prediction mode information, selectioninformation, and inter-prediction type information. For example, theencoding apparatus may generate a bitstream or encoded information byencoding image information including all or part of the above-describedinformation (or syntax elements). Alternatively, it may be output in theform of a bitstream. In addition, the bitstream or encoded informationmay be transmitted to the decoding apparatus through a network or astorage medium.

Although not illustrated in FIG. 14, for example, the encoding apparatusmay generate prediction samples of the current block. Alternatively, forexample, the encoding apparatus may generate prediction samples of thecurrent block based on the selected candidate. Alternatively, forexample, the encoding apparatus may derive motion information based onthe selected candidate, and may generate prediction samples of thecurrent block based on the motion information. For example, the encodingapparatus may generate L0 prediction samples and L1 prediction samplesaccording to bi-prediction, and may generate prediction samples of acurrent block based on the L0 prediction samples and the L1 predictionsamples. In this case, prediction samples of the current block may begenerated from the L0 prediction samples and the L1 prediction samplesusing weight index information (or weight information) forbi-prediction. Here, the weight information may be displayed based onthe weight index information.

In other words, for example, the encoding apparatus may generate L0prediction samples and L1 prediction samples of the current block basedon the selected candidate. For example, when the inter-prediction typeof the current block is determined to be bi-prediction, the referencepicture list 0 and the reference picture list 1 may be used forprediction of the current block. For example, the L0 prediction samplesmay represent prediction samples of the current block derived based onthe reference picture list 0, and the L1 prediction samples mayrepresent prediction samples of the current block derived based on thereference picture list 1.

For example, the candidates may include a spatial merge candidate. Forexample, when the selected candidate is the spatial merge candidate, L0motion information and L1 motion information may be derived based on thespatial merge candidate, and the L0 prediction samples and the L1prediction samples are generated based thereon.

For example, the candidates may include a temporal merge candidate. Forexample, when the selected candidate is the temporal merge candidate, L0motion information and L1 motion information may be derived based on thetemporal merge candidate, and the L0 prediction samples and the L1prediction samples are generated based thereon.

For example, the candidates may include pair-wise candidates. Forexample, when the selected candidate is a pair-wise candidate, L0 motioninformation and L1 motion information may be derived based on thepair-wise candidate, and the L0 prediction samples and the L1 predictionsamples may be generated based thereon. For example, the pair-wisecandidate may be derived based on two other candidates among thecandidates included in the merge candidate list.

Alternatively, for example, the merge candidate list may be a subblockmerge candidate list, and an affine merge candidate, a subblock mergecandidate, or an SbTMVP candidate may be selected. Here, the affinemerge candidate in units of subblocks may be referred to as a subblockmerge candidate.

For example, the candidates may include a subblock merge candidate. Forexample, when the selected candidate is the subblock merge candidate, L0motion information and L1 motion information may be derived based on thesubblock merge candidate, and the L0 prediction samples and the L1prediction samples are generated based thereon. For example, thesubblock merge candidate may include control point motion vectors(CPMVs), and the L0 prediction samples and the L1 prediction samples maybe generated by performing prediction in units of subblock based on theCPMVs.

Here, the CPMV may be indicated based on one block among neighboringblocks of a control point (CP) of the current block. For example, thenumber of CPs may be 2, 3, or 4, the CP may be positioned at at least apart of top-left (or top-left corner), top-right (or top-right corner),bottom-left (or bottom-left corner), or bottom-right (or bottom-rightcorner) of the current block, and only one CP may exist at eachposition.

For example, the CP may be CP0 positioned at the top-left of the currentblock. In this case, the neighboring blocks may include a bottom-leftcorner neighboring block of the current block, a top-left neighboringblock adjacent to the bottom of the top-left corner neighboring block,and a top neighboring block adjacent to the right of the bottom-leftcorner neighboring block. Alternatively, the neighboring blocks mayinclude an A₂ block, a B₂ block, or a B₃ block in FIG. 12.

Alternatively, for example, the CP may be a CP1 positioned at thetop-right of the current block. In this case, the neighboring blocks mayinclude a top-right corner neighboring block of the current block andatop neighboring block adjacent to the left of the top-right cornerneighboring block. Alternatively, the neighboring blocks may include aB0 block or a B1 block in FIG. 12.

Alternatively, for example, the CP may be CP2 positioned at thebottom-left of the current block. In this case, the neighboring blocksmay include the bottom-left corner neighboring block of the currentblock and the left neighboring block adjacent to the top of thebottom-left corner neighboring block. Alternatively, the neighboringblocks may include the A0 block or the A1 block in FIG. 12.

Alternatively, for example, the CP may be CP3 positioned at thebottom-right of the current block. In this case, the neighboring blocksmay include a col block of the current block or a bottom-right cornerneighboring block of the collocated block. Here, the collocated blockmay include a block at the same position as the current block in areference picture different from the current picture in which thecurrent block is positioned. Alternatively, the neighboring block mayinclude block T in FIG. 12.

Alternatively, for example, the candidates may include SbTMVPcandidates. For example, when the selected candidate is the SbTMVPcandidate, the L0 motion information and the L1 motion information maybe derived based on the left neighboring block of the current block, andbased on this, the L0 prediction samples and the L1 prediction samplesmay be generated. For example, the L0 prediction samples and the L1prediction samples may be generated by performing prediction in units ofsubblocks.

For example, the L0 motion information may include an L0 referencepicture index, an L0 motion vector, and the like, and the L1 motioninformation may include an L1 reference picture index, an L1 motionvector, and the like. The L0 reference picture index may includeinformation indicating the reference picture in the reference picturelist 0, and the L1 reference picture index may include informationindicating the reference picture in the reference picture list 1.

For example, the encoding apparatus may generate prediction samples ofthe current block based on L0 prediction samples, L1 prediction samples,and weight information. For example, the weight information may bedisplayed based on the weight index information. The weight indexinformation may indicate weight index information on bi-prediction. Forexample, the weight information may include information on a weightedaverage of L0 prediction samples or L1 prediction samples. That is, theweight index information may indicate index information on a weight usedfor the weighted average, and may generate weight index information in aprocedure of generating prediction samples based on the weightedaverage. For example, the weight index information may includeinformation indicating any one of three or five weights. For example,the weighted average may represent a weighted average in bi-predictionwith CU-level weight (BCW) or bi-prediction with weighted average (BWA).

For example, the candidates may include a temporal merge candidate, andthe weight index information on the temporal merge candidate may berepresented by 0. That is, the weight index information on the temporalmerge candidate may be represented by 0. Here, the weight indexinformation of 0 may mean that the weights of each reference direction(ie, the L0 prediction direction and the L1 prediction direction inbi-prediction) are the same. Alternatively, for example, the candidatesmay include a temporal merge candidate, and the weight index informationmay be indicated based on weight index information on a col block. Thatis, the weight index information on the temporal merge candidate may beindicated based on the weight index information on the col block. Here,the collocated block may include a block at the same position as thecurrent block in a reference picture different from the current picturein which the current block is positioned.

For example, the candidates may include a pair-wise candidate, and theweight index information may be indicated based on weight indexinformation on one of the other two candidates in the merge candidatelist used to derive the pair-wise candidate. That is, the weight indexinformation on the pair-wise candidate may be indicated based on theweight index information on one of the other two candidates in the mergecandidate list used to derive the pair-wise candidate.

For example, the candidates may include the pair-wise candidate, and thepair-wise candidate may be indicated based on other two candidates amongthe candidates. When the weight index information on each of the othertwo candidates is the same as the first weight index information, theweight index information on the pair-wise candidate may be indicatedbased on the first weight index information, When the weight indexinformation on each of the other two candidates is not the same, theweight index information on the pair-wise candidate may be indicatedbased on default weight index information, and In this case, the defaultweight index information may correspond to weight index information ongiving the same weight to each of the L0 prediction samples and the L1prediction samples.

For example, the candidates may include the pair-wise candidate, and thepair-wise candidate may be indicated based on other two candidates amongthe candidates. When the weight index information on each of the othertwo candidates is the same as the first weight index information, theweight index information on the pair-wise candidate may be indicatedbased on the first weight index information. When the weight indexinformation on each of the other two candidates is not the same, theweight index information may be indicated based on weight indexinformation rather than the default weight index information among theweight index information of each of the other two candidates. Thedefault weight index information may correspond to weight indexinformation on giving the same weight to each of the L0 predictionsamples and the L1 prediction samples.

For example, the merge candidate list may be a subblock merge candidatelist, and an affine merge candidate, a subblock merge candidate, or anSbTMVP candidate may be selected. Here, the affine merge candidate inunits of subblocks may be referred to as a subblock merge candidate.

For example, the candidates may include an affine merge candidate, andthe affine merge candidate may include at least one of control point 0(CP0) positioned at the top-left of the current block, CP1 (controlpoint 1) positioned at the top-right of the current block, control point2 (CP2) positioned at the bottom-left of the current block, and controlpoint 3 (CP3) positioned at the bottom-right of the current block.

For example, when the affine merge candidate is generated based on anyone of {CP0, CP1, CP2}, {CP01, CP1, CP3}, {CP0, CP2, CP3}, {CP0, CP1},and {CP0, CP2}, weight index information on the affine merge candidatemay be indicated based on weight index information on a specific blockamong neighboring blocks of the CP0. When the affine merge candidate isgenerated based on {CP1, CP2, CP3}, the weight index information on theaffine merge candidate may be indicated based on weight indexinformation of a specific block among neighboring blocks of CP1.

A specific block among the neighboring blocks of CP0 corresponds to theblock used for derivation of CPMV for the CP0, and the neighboringblocks of CP0 may include the bottom-left corner neighboring block ofthe current block, the left neighboring block adjacent to the bottom ofthe bottom-left corner neighboring block, and the top neighboring blockadjacent to the right of the bottom-left corner neighboring block.

Among the neighboring blocks of the CP1, a specific block corresponds tothe block used for derivation of the CPMV for the CP1, and theneighboring blocks of the CP1 may include the top-right cornerneighboring block of the current block and the top neighboring blockadjacent to the left of the top-right corner neighboring block.

Alternatively, for example, the candidates may include an SbTMVPcandidate, and weight index information on the SbTMVP candidate may beindicated based on weight index information on a left neighboring blockof the current block. That is, the weight index information on theSbTMVP candidate may be indicated based on the weight index informationon the left neighboring block.

Alternatively, for example, the candidates may include the SbTMVPcandidate, and weight index information on the SbTMVP candidate may berepresented by 0. That is, the weight index information on the SbTMVPcandidate may be represented by 0. Here, the weight index information of0 may mean that the weights of each reference direction (ie, the L0prediction direction and the L1 prediction direction in bi-prediction)are the same.

Alternatively, for example, the candidates may include the SbTMVPcandidate, and the weight index information may be indicated based onweight index information on a center block in a col block. That is, theweight index information on the SbTMVP candidate may be indicated basedon the weight index information on the center block in the col block.Here, the collocated block may include a block at the same position asthe current block in a reference picture different from the currentpicture in which the current block is positioned, and the center blockmay include a bottom-right subblock among four subblocks located in thecenter of the collocated block.

Alternatively, for example, the candidates may include the SbTMVPcandidate, and the weight index information may be indicated based onweight index information on each of the subblocks in a col block. Thatis, the weight index information on the SbTMVP candidate may beindicated based on the weight index information on each of the subblocksof the col block.

For example, the encoding apparatus may generate a bitstream or encodedinformation by encoding image information including all or part of theabove-described information (or syntax elements). Alternatively, it maybe output in the form of a bitstream. In addition, the bitstream orencoded information may be transmitted to the decoding apparatus througha network or a storage medium. Alternatively, the bitstream or theencoded information may be stored in a computer-readable storage medium,and the bitstream or the encoded information may be generated by theabove-described image encoding method.

FIGS. 16 and 17 are diagrams schematically illustrating an example of avideo/image decoding method and related components according toembodiment(s) of the present disclosure.

The method disclosed in FIG. 16 may be performed by a decoding apparatusdisclosed in FIG. 3 or 17. For example, S1600 of FIG. 16 may beperformed by an entropy decoder 310 of a decoding apparatus 300 in FIG.17, and S1610 of FIG. 16 may be performed by the residual processor 320of the decoding apparatus 300 in FIG. 17. In addition, S1600 to S1660 ofFIG. 16 may be performed by an entropy decoder 330 of the decodingapparatus 300 in FIG. 17, and S1670 of FIG. 16 may be performed by anadder 340 of the decoding apparatus 300 in FIG. 17. Also, although notillustrated in FIG. 16, prediction-related information or residualinformation may be derived from a bitstream by the entropy decoder 310of the decoding apparatus 300 in FIG. 17. The method disclosed in FIG.16 may include the embodiments described above in the presentdisclosure.

Referring to FIG. 16, the decoding apparatus may receive imageinformation including inter-prediction mode information and residualinformation through a bitstream (S1600). For example, the imageinformation may be referred to as video information. The imageinformation may include various information according to theabove-described embodiment(s) of the present disclosure. For example,the image information may include at least a part of prediction-relatedinformation or residual-related information.

For example, the prediction-related information may includeinter-prediction mode information or inter-prediction type information.For example, the inter-prediction mode information may includeinformation indicating at least some of various inter-prediction modes.For example, various modes such as a merge mode, a skip mode, a motionvector prediction (MVP) mode, an affine mode, a subblock merge mode, ora merge with MVD (MMVD) mode may be used. In addition, a decoder sidemotion vector refinement (DMVR) mode, an adaptive motion vectorresolution (AMVR) mode, a bi-prediction with CU-level weight, or abi-directional optical flow (BDOF), etc. may be used in addition orinstead as ancillary mods. For example, the inter-prediction typeinformation may include an inter_pred_idc syntax element. Alternatively,the inter-prediction type information may include information indicatingany one of L0 prediction, L1 prediction, and bi-prediction.

The decoding apparatus may generate the residual samples based on theresidual information (S1610). The decoding apparatus may derivequantized transform coefficients based on the residual information, andmay derive residual samples based on an inverse transform procedure forthe transform coefficients.

The decoding apparatus may generate a merge candidate list of thecurrent block based on the inter-prediction mode information (S1620).For example, the decoding apparatus may determine the inter-predictionmode of the current block as a merge mode, an affine (merge) mode, or asubblock merge mode based on the inter-prediction mode information, andgenerate a merge candidate list according to the determinedinter-prediction mode. Here, when the inter-prediction mode is an affinemerge mode or a subblock merge mode, the merge candidate list may bereferred to as an affine merge candidate list or a subblock mergecandidate list, but may also be simply referred to as a merge candidatelist.

For example, candidates may be inserted into the merge candidate listuntil the number of candidates in the merge candidate list becomes themaximum number of candidates. Here, the candidate may indicate acandidate or a candidate block for deriving motion information (ormotion vector) of the current block. For example, the candidate blockmay be derived through a search for neighboring blocks of the currentblock. For example, a neighboring block may include a spatialneighboring block and/or a temporal neighboring block of the currentblock, a spatial neighboring block may be preferentially searched toderive a (spatial merge) candidate, and then a temporal neighboringblock may be searched to derive a (temporal merge) candidate, and thederived candidates may be inserted into the merge candidate list. Forexample, when the number of candidates in the merge candidate list isless than the maximum number of candidates in the merge candidate listeven after the candidates are inserted, additional candidates may beinserted. For example, additional candidates include at least one ofhistory based merge candidate(s), pair-wise average merge candidate(s),ATMVP, and combined bi-predictive merge candidates (when the slice/tilegroup type of the current slice/tile group is type B) and/or a zerovector merge candidate.

Alternatively, for example, candidates may be inserted into the affinemerge candidate list until the number of candidates in the affine mergecandidate list becomes the maximum number of candidates. Here, thecandidate may include a control point motion vector (CPMV) of thecurrent block. Alternatively, the candidate may indicate a candidate ora candidate block for deriving the CPMV. The CPMV may indicate a motionvector at a control point (CP) of the current block. For example, thenumber of CPs may be 2, 3, or 4, the CP may be positioned at at least apart of top-left (or top-left corner), top-right (or top-right corner),bottom-left (or bottom-left corner), or bottom-right (or bottom-rightcorner) of the current block, and only one CP may exist at eachposition.

For example, a candidate block may be derived through a search for aneighboring block (or a neighboring block of a CP of the current block)of the current block. For example, the affine merge candidate list mayinclude at least one of an inherited affine merge candidate, aconstructed affine merge candidate, and a zero motion vector candidate.For example, in the affine merge candidate list, the inherited affinemerge candidate may be inserted first, and then the constructed affinemerge candidate may be inserted. In addition, even though affine mergecandidates constructed in the affine merge candidate list are inserted,when the number of candidates in the affine merge candidate list issmaller than the maximum number of candidates, the remainder may befilled with zero motion vector candidates. Here, the zero motion vectorcandidate may be referred to as a zero vector. For example, the affinemerge candidate list may be a list according to an affine merge mode inwhich a motion vector is derived in units of samples, or may be a listaccording to an affine merge mode in which a motion vector is derived inunits of subblocks. In this case, the affine merge candidate list may bereferred to as a subblock merge candidate list, and the subblock mergecandidate list may also include candidates (or SbTMVP candidates)derived from SbTMVP. For example, when the SbTMVP candidate is includedin the subblock merge candidate list, it may be positioned before theinherited affine merge candidate and the constructed affine mergecandidate in the subblock merge candidate list.

The decoding apparatus may derive motion information of the currentblock based on a candidate selected from the merge candidate list(S1630). For example, the merge candidate list may include at least someof a spatial merge candidate, a temporal merge candidate, a pair-wisecandidate, or a zero vector candidate, and one of these candidates maybe selected for inter-prediction of the current block. Alternatively,for example, the subblock merge candidate list may include at least someof an inherited affine merge candidate, a constructed affine mergecandidate, an SbTMVP candidate, or a zero vector candidate, and onecandidate of these candidates for inter-prediction of the current blockmay be selected. For example, the selected candidate may be selectedfrom the merge candidate list based on selection information. Forexample, the selection information may include index informationindicating a selected candidate in the merge candidate list. Forexample, the selection information may be referred to as merge indexinformation or subblock merge index information. For example, theselection information may be included in the image information.Alternatively, the selection information may be included in theinter-prediction mode information.

The decoding apparatus may generate L0 prediction samples and L1prediction samples of the current block based on the motion information(S1640). For example, the decoding apparatus may derive L0 motioninformation and L1 motion information based on a candidate selected asthe inter-prediction type is derived as bi-prediction. The decodingapparatus may derive the inter-prediction type of the current block asbi-prediction based on the inter-prediction type information. Forexample, the inter-prediction type of the current block may be derivedas bi-prediction among L0 prediction, L1 prediction, or bi-predictionbased on the inter-prediction type information. Here, L0 prediction mayindicate prediction based on reference picture list 0, L1 prediction mayindicate prediction based on reference picture list 1, and bi-predictionmay indicate prediction based on reference picture list 0 and referencepicture list 1. For example, the inter-prediction type information mayinclude an inter_pred_idc syntax element.

For example, the L0 motion information may include an L0 referencepicture index, an L0 motion vector, and the like, and the L1 motioninformation may include an L1 reference picture index, an L1 motionvector, and the like. The L0 reference picture index may includeinformation indicating the reference picture in the reference picturelist 0, and the L1 reference picture index may include informationindicating the reference picture in the reference picture list 1.

For example, the candidates may include a spatial merge candidate. Forexample, when the selected candidate is the spatial merge candidate, L0motion information and L1 motion information may be derived based on thespatial merge candidate, and the L0 prediction samples and the L1prediction samples are generated based thereon.

For example, the candidates may include a temporal merge candidate. Forexample, when the selected candidate is the temporal merge candidate, L0motion information and L1 motion information may be derived based on thetemporal merge candidate, and the L0 prediction samples and the L1prediction samples are generated based thereon.

For example, the candidates may include pair-wise candidates. Forexample, when the selected candidate is a pair-wise candidate, L0 motioninformation and L1 motion information may be derived based on thepair-wise candidate, and the L0 prediction samples and the L1 predictionsamples may be generated based thereon. For example, the pair-wisecandidate may be derived based on two other candidates among thecandidates included in the merge candidate list.

Alternatively, for example, the merge candidate list may be a subblockmerge candidate list, and an affine merge candidate, a subblock mergecandidate, or an SbTMVP candidate may be selected. Here, the affinemerge candidate in units of subblocks may be referred to as a subblockmerge candidate.

For example, the candidates may include an affine merge candidate. Forexample, when the selected candidate is the affine merge candidate, L0motion information and L1 motion information may be derived based on theaffine merge candidate, and the L0 prediction samples and the L1prediction samples are generated based thereon. For example, the affinemerge candidate may include control point motion vectors (CPMVs), andthe L0 prediction samples and the L1 prediction samples may be generatedby performing prediction in units of subblock based on the CPMVs.

Here, the CPMV may be derived based on one of neighboring blocks of thecontrol point (CP) of the current block. For example, the number of CPsmay be 2, 3, or 4, the CP may be positioned at at least a part oftop-left (or top-left corner), top-right (or top-right corner),bottom-left (or bottom-left corner), or bottom-right (or bottom-rightcorner) of the current block, and only one CP may exist at eachposition.

For example, the CP may be CP0 positioned at the top-left of the currentblock. In this case, the neighboring blocks may include a bottom-leftcorner neighboring block of the current block, a top-left neighboringblock adjacent to the bottom of the top-left corner neighboring block,and a top neighboring block adjacent to the right of the bottom-leftcorner neighboring block. Alternatively, the neighboring blocks mayinclude an A2 block, a B2 block, or a B3 block in FIG. 12.

Alternatively, for example, the CP may be a CP1 positioned at thetop-right of the current block. In this case, the neighboring blocks mayinclude a top-right corner neighboring block of the current block and atop neighboring block adjacent to the left of the top-right cornerneighboring block. Alternatively, the neighboring blocks may include aB0 block or a B1 block in FIG. 12.

Alternatively, for example, the CP may be CP2 positioned at thebottom-left of the current block. In this case, the neighboring blocksmay include the bottom-left corner neighboring block of the currentblock and the left neighboring block adjacent to the top of thebottom-left corner neighboring block. Alternatively, the neighboringblocks may include the A0 block or the A1 block in FIG. 12.

Alternatively, for example, the CP may be CP3 positioned at thebottom-right of the current block. Here, CP3 may also be referred to asRB. In this case, the neighboring blocks may include a col block of thecurrent block or a bottom-right corner neighboring block of thecollocated block. Here, the collocated block may include a block at thesame position as the current block in a reference picture different fromthe current picture in which the current block is positioned.Alternatively, the neighboring block may include block T in FIG. 12.

Alternatively, for example, the candidates may include SbTMVPcandidates. For example, when the selected candidate is the SbTMVPcandidate, the L0 motion information and the L1 motion information maybe derived based on the left neighboring block of the current block, andbased on this, the L0 prediction samples and the L1 prediction samplesmay be generated. For example, the L0 prediction samples and the L1prediction samples may be generated by performing prediction in units ofsubblocks.

For example, the decoding apparatus may generate prediction samples ofthe current block based on L0 prediction samples, L1 prediction samples,and weight information (S1260). For example, the weight information maybe derived based on weight index information on a candidate selectedfrom among candidates included in the merge candidate list. For example,the weight information may include information on a weighted average ofL0 prediction samples or L1 prediction samples. That is, the weightindex information may indicate index information on the weights used forthe weighted average, and the weighted average may be performed based onthe weight index information. For example, the weight index informationmay include information indicating any one of three or five weights. Forexample, the weighted average may represent a weighted average inbi-prediction with CU-level weight (BCW) or bi-prediction with weightedaverage (BWA).

For example, the candidates may include a temporal merge candidate, andthe weight index information on the temporal merge candidate may bederived as 0. That is, the weight index information on the temporalmerge candidate may be derived as 0. Here, the weight index informationof 0 may mean that the weights of each reference direction (ie, the L0prediction direction and the L1 prediction direction in bi-prediction)are the same.

For example, the candidates may include a temporal merge candidate, andthe weight index information on the temporal merge candidate may bederived based on weight index information on a col block. That is, theweight index information on the temporal merge candidate may be derivedbased on the weight index information on the col block. Here, thecollocated block may include a block at the same position as the currentblock in a reference picture different from the current picture in whichthe current block is positioned.

For example, the candidates may include a pair-wise candidate, and theweight index information may be derived as the weight index informationon one of the other two candidates in the merge candidate list used toderive the pair-wise candidate. That is, the weight index information onthe pair-wise candidate may be derived as the weight index informationon one of the other two candidates in the merge candidate list used toderive the pair-wise candidate.

For example, the candidates may include the pair-wise candidate, and thepair-wise candidate may be derived based on other two candidates amongthe candidates. When the weight index information of each on the othertwo candidates is the same as the first weight index information, theweight index information for the pair-wise candidate may be derivedbased on the first weight index information. When the weight indexinformation on each of the other two candidates is not the same, theweight index information on the pair-wise candidate may be derived basedon default weight index information, and In this case, the defaultweight index information may correspond to weight index information ongiving the same weight to each of the L0 prediction samples and the L1prediction samples.

For example, the candidates may include the pair-wise candidate, and thepair-wise candidate may be derived based on other two candidates amongthe candidates. When the weight index information of each on the othertwo candidates is the same as the first weight index information, theweight index information for the pair-wise candidate may be derivedbased on the first weight index information. When the weight indexinformation on each of the other two candidates is not the same, theweight index information may be derived based on weight indexinformation rather than the default weight index information among theweight index information of each of the other two candidates. Thedefault weight index information may correspond to weight indexinformation on giving the same weight to each of the L0 predictionsamples and the L1 prediction samples.

For example, the merge candidate list may be a subblock merge candidatelist, and an affine merge candidate, a subblock merge candidate, or anSbTMVP candidate may be selected. Here, the affine merge candidate inunits of subblocks may be referred to as a subblock merge candidate.

For example, the candidates may include an affine merge candidate, andthe affine merge candidate may include at least one of control point 0(CP0) positioned at the top-left of the current block, control point 1(CP1) positioned at the top-right of the current block, control point 2(CP2) positioned at the bottom-left of the current block, and controlpoint 3 (CP3) positioned at the bottom-right of the current block.

For example, when the affine merge candidate is generated based on anyone of {CP0, CP1, CP2}, {CP0, CP1, CP3}, {CP0, CP2, CP3}, {CP0, CP1},and {CP0, CP2}, weight index information on the affine merge candidatemay be indicated based on weight index information on a specific blockamong neighboring blocks of the CP0. When the affine merge candidate isgenerated based on {CP1, CP2, CP3}, the weight index information on theaffine merge candidate may be indicated based on weight indexinformation of a specific block among neighboring blocks of CP1.

A specific block among the neighboring blocks of CP0 corresponds to theblock used for derivation of CPMV for the CP0, and the neighboringblocks of CP0 may include the top-left corner neighboring block of thecurrent block, the left neighboring block adjacent to the bottom of thetop-left corner neighboring block, and the top neighboring blockadjacent to the right of the top-left corner neighboring block.

Among the neighboring blocks of the CP1, a specific block corresponds tothe block used for derivation of the CPMV for the CP1, and the CP1neighboring blocks may include the top-right corner neighboring block ofthe current block and the top neighboring block adjacent to the left ofthe top-right corner neighboring block.

Alternatively, for example, the candidates may include an SbTMVPcandidate, and weight index information on the SbTMVP candidate may bederived based on weight index information on a left neighboring block ofthe current block. That is, the weight index information on the SbTMVPcandidate may be derived based on the weight index information on theleft neighboring block.

Alternatively, for example, the candidates may include the SbTMVPcandidate, and weight index information on the SbTMVP candidate may bederived as 0. That is, the weight index information on the SbTMVPcandidate may be derived as 0. Here, the weight index information of 0may mean that the weights of each reference direction (ie, the L0prediction direction and the L1 prediction direction in bi-prediction)are the same.

Alternatively, for example, the candidates may include the SbTMVPcandidate, and the weight index information may be derived based onweight index information on a center block in a col block. That is, theweight index information on the SbTMVP candidate may be derived based onthe weight index information on the center block in the col block. Here,the collocated block may include a block at the same position as thecurrent block in a reference picture different from the current picturein which the current block is positioned, and the center block mayinclude a bottom-right subblock among four subblocks located in thecenter of the collocated block.

Alternatively, for example, the candidates may include the SbTMVPcandidate, and the weight index information may be derived based onweight index information on each of the subblocks in a col block. Thatis, the weight index information on the SbTMVP candidate may be derivedbased on the weight index information on each of the subblocks of thecol block.

The decoding apparatus may generate reconstructed samples based on theprediction samples and the residual samples (S1660). For example, thedecoding apparatus may generate reconstructed samples based on theprediction samples and the residual samples, and derive thereconstructed block and the reconstructed picture based on thereconstructed samples.

For example, the decoding apparatus may obtain image informationincluding all or parts of the above-described pieces of information (orsyntax elements) by decoding the bitstream or the encoded information.Further, the bitstream or the encoded information may be stored in acomputer readable storage medium, and may cause the above-describeddecoding method to be performed.

Although methods have been described on the basis of a flowchart inwhich steps or blocks are listed in sequence in the above-describedembodiments, the steps of the present document are not limited to acertain order, and a certain step may be performed in a different stepor in a different order or concurrently with respect to that describedabove. Further, it will be understood by those ordinary skilled in theart that the steps of the flowcharts are not exclusive, and another stepmay be included therein or one or more steps in the flowchart may bedeleted without exerting an influence on the scope of the presentdisclosure.

The aforementioned method according to the present disclosure may be inthe form of software, and the encoding apparatus and/or decodingapparatus according to the present disclosure may be included in adevice for performing image processing, for example, a TV, a computer, asmart phone, a set-top box, a display device, or the like.

When the embodiments of the present disclosure are implemented bysoftware, the aforementioned method may be implemented by a module(process or function) which performs the aforementioned function. Themodule may be stored in a memory and executed by a processor. The memorymay be installed inside or outside the processor and may be connected tothe processor via various well-known means. The processor may includeApplication-Specific Integrated Circuit (ASIC), other chipsets, alogical circuit, and/or a data processing device. The memory may includea Read-Only Memory (ROM), a Random Access Memory (RAM), a flash memory,a memory card, a storage medium, and/or other storage device. In otherwords, the embodiments according to the present disclosure may beimplemented and executed on a processor, a micro-processor, acontroller, or a chip. For example, functional units illustrated in therespective figures may be implemented and executed on a computer, aprocessor, a microprocessor, a controller, or a chip. In this case,information on implementation (for example, information on instructions)or algorithms may be stored in a digital storage medium.

In addition, the decoding apparatus and the encoding apparatus to whichthe embodiment(s) of the present document is applied may be included ina multimedia broadcasting transceiver, a mobile communication terminal,a home cinema video device, a digital cinema video device, asurveillance camera, a video chat device, and a real time communicationdevice such as video communication, a mobile streaming device, a storagemedium, a camcorder, a video on demand (VoD) service provider, an OverThe Top (OTT) video device, an internet streaming service provider, a 3Dvideo device, a Virtual Reality (VR) device, an Augment Reality (AR)device, an image telephone video device, a vehicle terminal (forexample, a vehicle (including an autonomous vehicle) terminal, anairplane terminal, or a ship terminal), and a medical video device; andmay be used to process an image signal or data. For example, the OTTvideo device may include a game console, a Bluray player, anInternet-connected TV, a home theater system, a smartphone, a tablet PC,and a Digital Video Recorder (DVR).

In addition, the processing method to which the embodiment(s) of thepresent document is applied may be produced in the form of a programexecuted by a computer and may be stored in a computer-readablerecording medium. Multimedia data having a data structure according tothe embodiment(s) of the present document may also be stored in thecomputer-readable recording medium. The computer readable recordingmedium includes all kinds of storage devices and distributed storagedevices in which computer readable data is stored. The computer-readablerecording medium may include, for example, a Bluray disc (BD), auniversal serial bus (USB), a ROM, a PROM, an EPROM, an EEPROM, a RAM, aCD-ROM, a magnetic tape, a floppy disk, and an optical data storagedevice. The computer-readable recording medium also includes mediaembodied in the form of a carrier wave (for example, transmission overthe Internet). In addition, a bitstream generated by the encoding methodmay be stored in the computer-readable recording medium or transmittedthrough a wired or wireless communication network.

In addition, the embodiment(s) of the present document may be embodiedas a computer program product based on a program code, and the programcode may be executed on a computer according to the embodiment(s) of thepresent document. The program code may be stored on a computer-readablecarrier.

FIG. 18 is a diagram illustrating an example of a content streamingsystem to which embodiments disclosed in the present disclosure may beapplied.

Referring to FIG. 18, a content streaming system to which embodiments ofthe present disclosure are applied may largely include an encodingserver, a streaming server, a web server, a media storage, a userdevice, and a multimedia input device.

The encoding server functions to compress to digital data the contentsinput from the multimedia input devices, such as the smart phone, thecamera, the camcorder and the like, to generate a bitstream, and totransmit it to the streaming server. As another example, in a case wherethe multimedia input device, such as, the smart phone, the camera, thecamcorder or the like, directly generates a bitstream, the encodingserver may be omitted.

The bitstream may be generated by an encoding method or a bitstreamgeneration method to which the embodiments of the present document isapplied. And the streaming server may temporarily store the bitstream ina process of transmitting or receiving the bitstream.

The streaming server transmits multimedia data to the user equipment onthe basis of a user's request through the web server, which functions asan instrument that informs a user of what service there is. When theuser requests a service which the user wants, the web server transfersthe request to the streaming server, and the streaming server transmitsmultimedia data to the user. In this regard, the contents streamingsystem may include a separate control server, and in this case, thecontrol server functions to control commands/responses betweenrespective equipment in the content streaming system.

The streaming server may receive contents from the media storage and/orthe encoding server. For example, in a case the contents are receivedfrom the encoding server, the contents may be received in real time. Inthis case, the streaming server may store the bitstream for apredetermined period of time to provide the streaming service smoothly.

For example, the user equipment may include a mobile phone, a smartphone, a laptop computer, a digital broadcasting terminal, a personaldigital assistant (PDA), a portable multimedia player (PMP), anavigation, a slate PC, a tablet PC, an ultrabook, a wearable device(e.g., a watch-type terminal (smart watch), a glass-type terminal (smartglass), a head mounted display (HMD)), a digital TV, a desktop computer,a digital signage or the like.

Each of servers in the contents streaming system may be operated as adistributed server, and in this case, data received by each server maybe processed in distributed manner.

Claims in the present description can be combined in a various way. Forexample, technical features in method claims of the present descriptioncan be combined to be implemented or performed in an apparatus, andtechnical features in apparatus claims can be combined to be implementedor performed in a method. Further, technical features in method claim(s)and apparatus claim(s) can be combined to be implemented or performed inan apparatus. Further, technical features in method claim(s) andapparatus claim(s) can be combined to be implemented or performed in amethod.

What is claimed is:
 1. An image decoding method performed by a decodingapparatus, the image decoding method comprising: obtaining, through abitstream, image information including inter-prediction mode informationand (ii) residual information; generating residual samples based on theresidual information; generating a merge candidate list of a currentblock based on the inter-prediction mode information; deriving motioninformation on the current block based on a candidate selected fromcandidates included in the merge candidate list; generating L0prediction samples and L1 prediction samples of the current block basedon the motion information; generating prediction samples of the currentblock by performing bi-prediction based on the L0 prediction samples,the L1 prediction samples, and weight information for the current block,wherein the weight information is derived based on a weight index forthe selected candidate; and generating reconstructed samples based onthe prediction samples and the residual samples, wherein the candidatesinclude affine merge candidates, and each of the affine merge candidatesincludes at least two of a control point motion vector (CPMV) for acontrol point 0 (CP0), a CPMV for a control point 1 (CP1), a CPMV for acontrol point 2 (CP2), or a CPMV for a control point 3 (CP3), whereinthe CP0 is related to a top-left corner of the current block, the CP1 isrelated to a top-right corner of the current block, the CP2 is relatedto a bottom-left corner of the current block and the CP3 is related to abottom-right corner of the current block, based on a case that a firstaffine merge candidate is generated based on {CP0, CP1, CP2} and thebi-prediction is applied to the current block, a weight index for thefirst affine merge candidate is fixed to be equal to a weight index fora specific block among neighboring blocks of the CP0, wherein thespecific block among the neighboring blocks of the CP0 is a block usedfor deriving the CPMV for the CP0, based on a case that a second affinemerge candidate is generated based on {CP1, CP2, CP3} and thebi-prediction is applied to the current block, a weight index for thesecond affine merge candidate is fixed to be equal to a weight index fora specific block among neighboring blocks of the CP1, and wherein thespecific block among the neighboring blocks of the CP1 is a block usedfor deriving the CPMV for the CP1.
 2. The image decoding method of claim1, wherein the neighboring blocks of the CP0 include a top-left cornerneighboring block of the current block, a left neighboring blockadjacent to a bottom of the top-left corner neighboring block, and a topneighboring block adjacent to a right of the top-left corner neighboringblock.
 3. The image decoding method of claim 1, wherein the neighboringblocks of the CP1 include a top-right corner neighboring block of thecurrent block and a top neighboring block adjacent to a left of thetop-right corner neighboring block.
 4. The image decoding method ofclaim 1, wherein the candidates include a pair-wise candidate, and thepair-wise candidate is derived based on two candidates among thecandidates, and a weight index for the pair-wise candidate is derivedbased on a weight index for one of the two candidates.
 5. The imagedecoding method of claim 1, wherein the candidates include a pair-wisecandidate, and the pair-wise candidate is derived based on twocandidates among the candidates, and when weight indexes of the twocandidates are same as a first weight index, a weight index for thepair-wise candidate is derived based on the first weight index, when theweight indexes of the two candidates are not the same, the weight indexfor the pair-wise candidate is derived based on a default weight index,and the default weight index corresponds to a weight index assigning thesame weight to each of the L0 prediction samples and the L1 predictionsamples.
 6. The image decoding method of claim 1, wherein the candidatesinclude a pair-wise candidate, and the pair-wise candidate is derivedbased on two candidates among the candidates, and when weight indexes ofthe two candidates are same as a first weight index, a weight index forthe pair-wise candidate is derived based on the first weight index, whenthe weight indexes of the two candidates are not the same, the weightindex is derived based on a weight index other than a default weightindex among the weight indexes of the two candidates, and the defaultweight index corresponds to a weight index assigning the same weight toeach of the L0 prediction samples and the L1 prediction samples.
 7. Theimage decoding method of claim 1, wherein the candidates include asubblock-based temporal motion vector prediction (SbTMVP) candidate, aweight index for the SbTMVP candidate is derived based on a weight indexfor each of subblocks in a col block, and the col block includes a blockin the same position as the current block in a reference picturedifferent from a current picture in which the current block ispositioned.
 8. The image decoding method of claim 1, wherein thecandidates include a temporal merge candidate, and a weight index forthe temporal merge candidate is derived as
 0. 9. The image decodingmethod of claim 1, wherein the candidates include a temporal mergecandidate, a weight index for the temporal merge candidate is derivedbased on a weight index for a col block, and the col block includes ablock in the same position as the current block in a reference picturedifferent from a current picture in which the current block ispositioned.
 10. An image encoding method performed by an encodingapparatus, the image encoding method comprising: determining aninter-prediction mode of a current block and generating inter-predictionmode information indicating the inter-prediction mode; generating amerge candidate list of the current block based on the inter-predictionmode; generating selection information indicating one of candidatesincluded in the merge candidate list; generating residual informationbased on residual samples of the current block; and encoding imageinformation including the inter-prediction mode information, theselection information, and the residual information, wherein thecandidates include affine merge candidates, and each of the affine mergecandidates include at least two of a control point motion vector (CPMV)for control point 0 (CP0), a CPMV for a control point 1 (CP1), a CPMVfor a control point 2 (CP2), or a CPMV for a control point 3 (CP3),wherein the CP0 is related to a top-left corner of the current block,the CP1 is related to a top-right corner of the current block, the CP2is related to a bottom-left corner of the current block and the CP3 isrelated to a bottom-right corner of the current block, based on a casethat a first affine merge candidate is generated based on {CP0, CP1,CP2} and bi-prediction is applied to the current block, a weight indexfor the first affine merge candidate is fixed to be equal to a weightindex for a specific block among neighboring blocks of the CP0, whereinthe specific block among the neighboring blocks of the CP0 is a blockused for deriving the CPMV for the CP0, based on a case that a secondaffine merge candidate is generated based on {CP1, CP2, CP3} and thebi-prediction is applied to the current block, a weight index for thesecond affine merge candidate is fixed to be equal to a weight index fora specific block among neighboring blocks of the CP1, and wherein thespecific block among the neighboring blocks of the CP1 is a block usedfor deriving the CPMV for the CP1.
 11. A non-transitory computerreadable digital storage medium storing a bitstream generated by animage encoding method, the method comprising: determining aninter-prediction mode of a current block and generating inter-predictionmode information indicating the inter-prediction mode; generating amerge candidate list of the current block based on the inter-predictionmode; generating selection information indicating one of candidatesincluded in the merge candidate list; generating residual informationbased on residual samples of the current block; and encoding imageinformation to generate the bitstream, wherein the image informationincludes the inter-prediction mode information, the selectioninformation, and the residual information, wherein the candidatesinclude affine merge candidates, and each of the affine merge candidatesinclude at least two of a control point motion vector (CPMV) for controlpoint 0 (CP0), a CPMV for a control point 1 (CP1), a CPMV for a controlpoint 2 (CP2), or a CPMV for a control point 3 (CP3), wherein the CP0 isrelated to a top-left corner of the current block, the CP1 is related toa top-right corner of the current block, the CP2 is related to abottom-left corner of the current block and the CP3 is related to abottom-right corner of the current block, based on a case that a firstaffine merge candidate is generated based on {CP0, CP1, CP2} andbi-prediction is applied to the current block, a weight index for thefirst affine merge candidate is fixed to be equal to a weight index fora specific block among neighboring blocks of the CP0, wherein thespecific block among the neighboring blocks of the CP0 is a block usedfor deriving the CPMV for the CP0, based on a case that a second affinemerge candidate is generated based on {CP1, CP2, CP3} and thebi-prediction is applied to the current block, a weight index for thesecond affine merge candidate is fixed to be equal to a weight index fora specific block among neighboring blocks of the CP1, and wherein thespecific block among the neighboring blocks of the CP1 is a block usedfor deriving the CPMV for the CP1.